Applications make logging calls on logger objects.Loggers are organized in a hierarchical namespace and child loggers may inherit some logging properties from their parents in the namespace. Loggers allocates messages and passes them to handler for output; they uses logging levels in order to decide if they are interested in by a particular message.
In trace.properties
it is possible to define
handlers, loggers,
levels:
handlers
A handler represents an output, is identified by its name, has a type, and has some additional properties. By default three handlers are used:
tty is basic standard output on a console
logf is a handler for printing messages on a file
mesonly handler used by generation tools for traces without header
Each handler can define the header it will use, the type of logging (console, file, rolling file), and the file name.
The handler properties are the following:
type: is the type of the handler that may be:
Console : Log stream ends inside
System.out
or
System.err
File : Log stream is directed into a file
Rollingfile : A file set is used to roll the logs
JMX : Logging actions are send to the JMX notification system
pattern:is the message format. A pattern can be composed of elements. An element is prefixed by the % character.The possible items:
%h: the thread name
%O{1} : the Class name (basename only)
%M the method name
%L the line number
%d the date
%l the level
%m the message itself
%n a new line
output: is the output filename.
If automatic[4] is used, JOnAS will replace this tag with a file
pointing to
$JONAS_BASE/logs/<jonas_name_server>-<timestamp>.log
Switch is used for logging either on
System.out
or System.err
depending on the level of the log
fileNumber: is the number of file to use (for RollingFile)
maxSize:is the maximal size of the file (for Rolling file)
Note that another handler, named jmxHandler, can be used to allow to view the recent logs in the JOnAS administration console. By default the definition of this handler is commented, for performance reason.
loggers
Loggers are identified by names that are structured as a tree. The root of the tree is named root. Each logger 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 (see below). By default loggers inherit their level from their parents.
By default handlers assigned to the parent logger are automatically assign to child loggers. Setting 'additivity' to false inform the system that the logger will use only its own set of handlers.[5]
levels
the trace levels are the following:
ERROR errors. Should always be printed.
WARN warning. Should be printed.
INFO informative messages.
DEBUG debug messages. Should be printed only for debugging.