This project provides code to generate OpenLog errors and events from SSJS or Java. Significant benefits of the project are:

  • The code can reside in an NSF itself or can be deployed to the server as an extension library (OSGi plugin). The NSF versions have a GitHub project https://github.com/paulswithers/openlogjava. There are two branches, one for extlib and one for non-extlib. The OSGi plugin has a separate GitHub project https://github.com/paulswithers/openLogOSGi
  • Since M2 there is also a version of the NSF that does not require the Extension Library. The assumption is that if you're using OSGi plugins, you're already using the Extension Library.
  • Providing a custom error page is in use in the application, uncaught SSJS errors (i.e. errors where you don't have a try/catch block) will also be logged.
  • Flexible APIs for caught errors from SSJS.
  • Efficient logging from SSJS - all logging is done in the render response phase and if the same SSJS error/ event is triggered multiple times during the JSF lifecycle, it will only be processed once.
  • Since M2 all SSJS errors are also written out as facesMessages, so displayed to the user if you have an Error/ Errors control on the XPage.
  • Since M2, the same method can also be used from Java to provide the same functionality.
  • NSince M2, new xsp.properties are made available to allow you to suppress the message display to the user or define a generic error message. From SSJS and if you use the Java method, the generic message will only be displayed once per request.
  • Static methods for Java access, so no need to create an object before calling the code.
  • YouTube video to show how to implement it http://www.youtube.com/watch?v=mbZ8vamCNpE.

Thanks to Nathan Freeman, Tim Tripcony, Rene Winkelmeyer, Toby Samples for helping point me in the right direction on some technical difficulties.

Thanks, Nathan, for suggesting falling back to notes.ini.

Thanks, Mark Leusink, for pointing me in the direction of code in XPage Debug Toolbar project to access SSJS error line numbers etc, but fortunately I found out how to find the relevant properties from the underlying Java class, so took a different route.

Nathan is listed as a contributor because of his work on refactoring the original Java classes used for XPages Help Application that provided a starting point for this project.