Thursday, July 19, 2012

CXF Log Browser Demo

A Log Browser demo has been available in the CXF distributions  for more than a year now. This demo is based on the brilliant contribution from Thomasz Opanovicz done as part of his GSOC project.

What I would like to do is explain what exactly the CXF Log Browser can do right now, and suggest some ideas on how it can be enhanced.

At the moment, the browser can be used to poll the Atom-enabled management endpoints and display the available log entries, this can be done per every CXF service, JAX-WS or JAX-RS one. The Atom endpoints can be set up as described in this section and shown in the demo. Have a look at this image on how the browser can show the log entries, I think it is quite cool.  Note the entries are paged, example, one can go to the next, previous, first or last pages, from the current page.

At the moment the browser polls every time the "refresh" button is pressed - this is one minor thing that can be customized further, example, a browser can be asked to poll every 60 seconds.

The browser offers an option to restrict which log entries are displayed by letting users to set FIQL search queries.

Typically, the Atom endpoint (which handles the browser queries) captures the log events, transforms them to Atom feeds and keeps them in memory or overflows to a registered ReadWriteLogStorage if needed but what is interesting it can also be configured from the start  to read the log entries from the existing log files.

For example, it can be configured to check the directory where Karaf gets the log files created. CXF offers a file-based ReadableLogStorage interface implementation  which can check the existing log files matching a given naming pattern, figure out which log file is newer or older and get the log entries in whatever format is used to format them using the simple configuration involving no regular expressions at all. For example, have a look at this test which works with the log files available here as well as this configuration file (check the bean with id "storage3").

All of it needs to be more extensively tested but Log Browser is already offering a fairly involved support for working with the available log entries.

However, quite a few enhancements can be done which can make it more useful and eventually turn the browser into a management console of its own.

One obvious thing which is missing is the ability to capture events immediately, with a browser acting as a receiver. For example, it would be good to get Atom push endpoints sending the events to it too. Implementing an enhancement like this one would very likely lead to Web Sockets supported in CXF. The browser would be configured to support either push or pull style on the startup or perhaps it would keep the pull  style by default and get the real-time events displayed in the running line at the bottom of the window.

The browser can also offer an option to get the log files from the selected location downloaded to the local disk. 

We can also have at least two more tabs available. One would show the JMX statistics related to CXF, another one would show the message exchange details.

I'd like to encourage users to try the demo, and consider helping us with enhancing the browser further.  


No comments: