Events in my personal life took over at the end of March, and I realised I had not yet blogged about the last release of XPages OpenLog Logger. This had a number of feature enhancements.

The first was to move the openLogBean from requestScope to sessionScope. The reason for doing this was to address issues developers had encountered when an error is logged and the code subsequently redirects to a different XPage. Once a redirect happens, it’s a new request on the server, so requestScope, and the errors it holds, are discarded for the new request. So the errors never got logged. sessionScope should typically be eschewed in favour of viewScope, because it sits around for as long as the session persists and can take up memory. But I’m clearing the bean contents after logging, so there should not be any performance hit. The caveat, however, is that if a redirection has occurred, the error will be logged against the new XPage, not the previous one. I may review how that is done in the future, possible adding openLogBean.addErrorAndRedirectToPage() methods, to allow developers to log the error against the original page and allow the OpenLog code to handle the redirection.

The second was also on openLogBean, to make it easier to update existing SSJS error handling (thanks to Thomas Adrian for raising this). Previously, from events, you had to use openLogBean.addError(e, this.getParent()) because the method expected a component. Now, whether it’s from a property or an event, you can use openLogBean.addError(e, this). The code now checks whether this is an eventHandler, in which case it automatically calls getParent() to get the containing component. Of course the method still accepts the component, so any pre-existing code using addError(e, this.getParent()) will still work. This has been propagated through all the addError and addEvent methods.

Finally, Michael Residori added a feature request for the ability to set ExpireDate field on a log. The ExpireDate field is a special field that defines a document as expired, so it can be used by the in-built Domino database archiving. It’s something I had not been aware of, but you can now add an Xsp Property to define the number of days to adjust today’s date by, in order to set the ExpireDate field, e.g. xsp.openlog.expireDate=30 to set ExpireDate to today + 30 days. If the property is not set, no ExpireDate field is set. But it’s a good way to ensure OpenLog does not become bloated.

As ever, all the changes are also in the OSGi plugin version and in the latest development branch of OpenNTF Domino API.

Also, with this release, there is no non-Extension Library version. The latest release if you’re not using the Extension Library is 4.0.1. The GitHub project has also been consolidated now, so both the NSF and OSGi codestreams are in a single repository https://github.com/paulswithers/openlogjava.

Enjoy!

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top