For this month's project spotlight, I wanted to highlight error logging. Firstly, it's worth making a clear distinction, that the projects on OpenNTF help with error logging. But error handling is a completely different topic and no framework, regardless of the language, can ensure errors are appropriately handled for custom applications. Error handling comes down to managing the process in which the error occurs in a way that best supports the user and application, to ensure quality and integrity of data. For example, proper validation on both server-side and client-side would fall under error handling, but if the developer doesn't apply validation correctly in the right places, errors won't be handled adequately. Error logging is designed to aid support, not improve data quality and integrity.

Domino has had logging in-built in its core API for some time via the NotesLog class in LotusScript, corresponding to the Log class in Java. This allows logging to a Domino database, an email, a file or each agent's internal log (accessible via Agent > Log) in Domino Designer. But like the core Java logging mechanism, many (and possibly most) developers have chosen a more extensive open source solution for Domino - Julian Robichaux's excellent OpenLog.

For anyone not familiar with it, OpenLog not only captures logging from LotusScript and Java, but also JavaScript. It captures considerable information, including client versions, user triggering the error, access levels and roles, source of the error and stack trace. This is invaluable for tracking down the actual cause of an issue and has, in the past, allowed me to quickly identify the cause of an issue was an upgrade to a user, when I wasn't even aware upgrades were planned. Logging also allows document links to be added, to help identify document-related causes. In addition, notification profiles can be set up and standard Domino archiving processes can be utilised to keep database sizes manageable.

When XPages came along, a server-side JavaScript version was created for TaskJam by Matt White, but the project was not Apache-licensed, causing a problem for other projects that wanted to utilise it. That is why XPages Help Application included a Java library based on Julian's original OpenLog Java Script Library.

But the opportunity for XPages-specific enhancements increased as XPages and knowledge of the framework matured. This caused its evolution into a separate project XPages OpenLog Logger, by the same author, Paul Withers. XPages OpenLog Logger supported easier use from SSJS, filtering of errors so the same error was not logged for multiple phases of the XPages lifecycle, capturing uncaught exceptions, greater configuration and flexibility using notes.ini or and much more. It also allowed the library to be deployed within each application or server-wide as an OSGi plugin. Full documentation has also more recently been migrated to OpenNTF's Confluence server, in a specific space. The database errors are logged to and form used have not been changed - it still uses the original OpenLog project. But it brings a greater flexibility to error logging.

For those utilising the OpenNTF Domino API ( a growing number of developers), XPages OpenLog Logger comes as part of that plugin, making it available to XPages, to other OSGi plugins and applications, or even beyond Domino, in CrossWorlds.

But beyond the Domino space, Java developers are used to a different standard error logging approach. Historically this has meant log4j, but that has evolved into and been replaced by LogBack. Serdar Basegmez has taken that library and integrated it as a separate OpenNTF project, XLogBack, for a more a more Java-ish way of logging. The documentation (available to browse in the readme file on the Stash repository) gives a nice table of comparison with XPages OpenLog Logger.

So whether you're still developing Notes Client applications or using XPages, DOTS and going beyond Domino, OpenNTF provides best practice options for developers from a variety of backgrounds.

If you're developing or have developed a project with just print statements or no error logging at all, consider working with either Serdar or Paul (or the other project chefs of XPages OpenLog Logger) to leverage proper error logging. XPages OpenLog Logger has already been integrated into projects like Resource Reservations Extended and we would be happy to help include more robust error logging in other OpenNTF projects. And if you are interested in the ICS Developer Contest, having XPages OpenLog Logger or XLogBack integrated by another person would constitute having multiple contributors, and therefore a team!

comments powered byDisqus