Happy sysadmin Day !
Today is sysadmin day so I’d like to write an article for administrators.
One of the things an administrator has to deal with is how to track what happens. One way to get this information is through logging systems.
In this article, we will explore how to manipulate logs in a Bonita Open Solution installation.
Reminders about java loggers
As Bonita Open Solution is based on a java infrastructure, we’ll start by exploring how logging can be handled in a java application.
Java usually splits an application into several parts. Each part may have its own logger identified by a namespace. Each namespace can be configured separately.
Configuring a namespace involves setting the information level you want to display. Possible settings are:
- SEVERE for indicating serious failure which can break the system
- WARNING for indicating potential problems which may not break the system
- INFO for indicating messages giving information
- CONFIG for status configuration messages
- FINE, FINER and FINEST for indicating tracing information
- ALL for logging all messages
- OFF for turning off logging
Setting the level for a namespace is done by using this format : [cc] .level = [/cc] For example : [cc] org.ow2.bonita.level = INFO [/cc]
Now, what could be nice to have is a way to define where the logs will be written.
This can be set by using a handler, which is a java class. Common configurations provide some handlers which write to the console or a file.
Setting the handler for a namespace is done by using this format :
[cc]
.handlers =
[/cc]
For example :
[cc]
org.ow2.bonita.handlers = 5bonita.org.apache.juli.FileHandler
[/cc]
What should I log in Bonita ?
Bonita Open Solution defines several namespaces. First of all, you should define global settings by setting the namespaces org.ow2.bonita.level for engine logs and org.bonitasoft.level for Bonita User Experience logs.
Then, if you need information about process execution, the following namespaces could be useful
- org.ow2.bonita.runtime.model.Execution
- org.ow2.bonita.runtime.model.ExecuteNode
- org.ow2.bonita.definition.activity.AbstractActivity
- org.ow2.bonita.runtime.TaskManager
- org.ow2.bonita.definition.activity.ConnectorExecutor
- org.bonitasoft.forms.server.api.impl.FormWorkflowAPIImpl
- org.ow2.bonita.runtime.event.EventDispatcherThread
Set this properties if you need database or cache information
- org.hibernate
- net.sf.ehcache
Below is an example of a logging file for a Bonita tomcat bundle :
[cc]
handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler, 5bonita.org.apache.juli.FileHandler
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.
4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
5bonita.org.apache.juli.FileHandler.level = FINE
5bonita.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
5bonita.org.apache.juli.FileHandler.prefix = bonita.
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/bonita].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/bonita].handlers = 5bonita.org.apache.juli.FileHandler
org.ow2.bonita.handlers = 5bonita.org.apache.juli.FileHandler
org.bonitasoft.handlers = 5bonita.org.apache.juli.FileHandler
org.ow2.bonita.level = WARNING
org.bonitasoft.level = WARNING
org.bonitasoft.forms.server.api.impl.FormWorkflowAPIImpl.level = INFO
org.ow2.bonita.runtime.event.EventDispatcherThread.level = WARNING
org.hibernate.level = WARNING
net.sf.ehcache.level = WARNING
[/cc]
Before finishing the configuration, you’ll have to provide BOS with the configuration file to use. This is done by setting the JVM environment variable:
[cc]
java.util.logging.config.file
[/cc]
In Bonita tomcat bundle for example, this variable is set in the bin/setenv script and refers to the file external/logging/properties.