The logging system is based on Monolog, the standard API for ObjectWeb projects (refer to http://www.objectweb.org/monolog/doc/index.html). Configuring trace messages inside Jonas can be done in two ways:
Changing the trace.properties file to configure the traces statically, before the JOnAS Server is run (refer to $JONAS_BASE/conf/trace.properties).
Using the jonas admin command (refer to Section 6.1 jonas) to configure the traces dynamically while the JOnAS Server is running.
Note | |
---|---|
The SQL requests sent to a database can be easily traced using the JOnAS Logging system and the integrated P6Spy tool. The configuration steps are described in Chapter 4 Configuring JDBC DataSources. |
A standard file is provided in $JONAS_ROOT/conf/trace.properties (refer to $JONAS_BASE/conf/trace.properties). Use the CLASSPATH to retrieve this file.
The monolog documentation described in http://www.objectweb.org/monolog/doc/index.html provides more details about how to configure logging. Monolog is built over a standard log API (currently, log4j). Loggers can be defined, each one being backed on a handler.
A handler represents an output, is identified by its name, has a type, and has some additional properties. Two handlers have been defined in the trace.properties file (refer to $JONAS_BASE/conf/trace.properties):
tty is basic, standard output on a console, with no headers.
logf is a handler for printing messages on a file.
Each handler can define the header it will use, the type of logging (console, file, rolling file), and the file name.
Note that if the tag automatic is specified as the output filename, JOnAS will replace this tag with a file pointing to $JONAS_BASE/logs/<jonas_name_server>-<timestamp>.log.
The logf handler, which is bundled with JOnAS, uses this automatic tag.
Loggers are identified by names that are structured as a tree. The root of the tree is named root.
Each logger is a topical logger (that is, it is associated with a topic). Topic names are usually based on the package name. Each logger can define the handler it will use and the trace level among the following four values:
ERROR errors. Should always be printed.
WARN warning. Should be printed.
INFO informative messages, not typically used in Jonas (for example, test results).
DEBUG debug messages. Should be printed only for debugging.
If nothing has been defined for a logger, it will use the properties defined for its parent.
JOnAS code is written using the monolog API and can use the tty handler.
To set the DEBUG level for the logger used in the jonas_ejb module:
logger.org.objectweb.jonas_ejb.level DEBUG |