This week has been great for 'logging' fans :)

After XPages OpenLog Logger M6 release by Paul S. Withers, I have released the first preview for the XLogback project.

XLogback is the OSGi plugin implementation of Logback Project for Domino environments.

Logback has been started by Ceki Gulcu as an unofficial successor of Log4J. It offers a native implementation for SLF4J (Simple Logging Facade for Java) API. We actually use SLF4J and SLF4J delegates the logging to Logback. That's an important advantage for Java developers because as long as your code uses standard logging implementation provided by SLF4J (Logger classes, Markers, MDC, etc.) your own code is independent from Logback. In the future, you may start using another logging library (e.g. Log4J2) just by changing SLF4J libraries.

XLogback started as a side project for myself a year ago. I have been developing a Java library and OSGi plugins for my customer projects (as I blogged) and I started customizing Paul's OpenLogItem class for my needs. Since I have been using DOTS extensively on my customer projects, I have tried lots of iterations to adapt OpenLog logging into my projects.

At one point I found out that every time I change the logging implementation, I had to change the way I was logging in the projects. The solution was separating the logger interface and the logging engine, which is the official definition of Java logging framework. After short research, I liked the Logback Project because of its simple implementation and configuration. The source code is pretty straightforward and well-written. It wasn't so difficult to implement.

I have been using Logback on production environment for more than six months now. As many people asked about it, I have decided to refactor the logback part out of my framework.

On my framework, I was using an automated configuration based on my central configuration management plugin. So I can change the logging on-the-fly for specific projects, users or platforms and it also supports tell commands such as putting everything into debug mode. However, that part needs to implement a couple of large plugins which are quite mixed with the customer code. Therefore I simplified the process and added an automated configuration module which is fed by Notes.ini parameters. I have chosen this way not just because of simplicity, but also for the ease of administration. In my customer case, I have more than 6 application servers running Java code and working with file configuration is not practical for administration. On the other hand, notes.ini files can be managed by configuration documents on Domino servers.

If you are familiar with the concept of logging framework in Java, you would probably know, using Loggers is quite easy. You start your class with defining a Logger and simply use it.

A picture named M2

Using parameters in logging is also possible.

A picture named M3

Using the second one is a great performance gain, because it will perform the string operation only if logging is needed. This notation also less prone to errors and better for readability.

Make sure you look at Logback Manual about all details.

One question you may ask would be about XPages OpenLog logger vs. XLogback. This decision completely depends on what you need and how you write your code. Let me quote from readme documentation of XLogback.

"XPages OpenLog Logger has a great advantage of simplicity for XPages developers. If you are using OpenNTF Domino API, you can already use it by now. Even you don't want to install any plugins for your environment, you can easily import necessary libraries into your NSF and it will work.

On the other hand, XLogback provides more JAVA-ish way for logging. So XLogback provides more universal logging mechanism for any Java library you have developed, with the ability to move your code into totally different Java environment. Also appender support is significant. Different types of appenders can be defined in parallel to OpenLog. Check Logback web site for very interesting scenarios."

I have also created a small comparison table at the documentation.

What is next?

Right now the project is for preview. It has been tested with XPages, Servlets and DOTS tasklets on Domino 9.0.1 environment but there are still things to do for production quality.

Considering the XPages developer population in the community, I'm planning to prioritize the XPages improvements first. I will import some functionality from Paul's OpenLog logger project for better usability for XPages developers.

The second phase will be focused on configuration. Right now, automatic configuration uses console/file/openlog logging at the same time but we need more customization.

Your contribution at this point is quite important. How do you use the logging? How do you want to use it? What are your priorities? Please let me know.

Go to the code repository of XLogback to see the code or Jira page for contributions and start today...

comments powered byDisqus