Debugging and Troubleshooting NSF Components
This article explains how to debug NSF (or Lotus Notes) components. Debugging and troubleshooting composite applications in general is covered in this article.
Use the following guidelines and tips when logging and debugging NSF components:
- The LotusScript debugger may be helpful in debugging NSF component. but there are challenges with composite applications. Challenges can occur especially when there are multiple pieces of LotusScript code running at the same time in different components, which may not all start in the same order. In this case, you only get to debug whichever one starts up first.
- If your focus is on debugging the component, as opposed to the application, a good technique to get past this is to create a unit test.
- Unit testing is covered completely in this article
. For debugging, the basic idea is to create a test composite application that contains only the component under test, and a special testing component. You can then wire up the testing component to the specific properties and actions of the component under test that you want. Through the UI of the testing component you can send specific values to th component under test's actions, or conduct ui operations and see the values reflected in the properties.
- In this sort of setup the debugger can be used quite successfully. Because you fully control what is going on, you can trigger the event you wish, and then step through the code.
- A "standard types tester" component is provided in the Component Library on OpenNTF
. This is suitable for use with components that use standard types. If you need more than that, the article above includes instructions on making your own tester component.
- 'Print' statements are particularly helpful in letting you see the order that events occurred in. These do not grab focus the way a modal dialog (msgbox) does. They require fewer mouse clicks than "msgbox", and you can see the results easily. This is useful only if there are not too many events as the history shows only the last 20 or so.
- When you add LogStatusBar=1 in your NOTES.INI file, it causes your status bar output to be written to your log.nsf file. This lets you use Print statements in your components and retain a record of what they wrote.
- Trapping errors is especially helpful for troubleshooting LotusScript code. Using this technique lets you see what line number errors occurred on. Search DeveloperWorks for "Debugging Domino Applications" for more techniques on troubleshooting LotusScript code.
- Another technique is to use the NotesLog class to log information to a text file (OpenFileLog method) or Notes document (OpenNotesLog).
- Visit OpenNTF.org
for a logging application which is very popular.
Resources
Need support?
This wiki is designed to provide valuable information to help you, but it does not replace other technical support services. Refer the following resources for more information.