The Rhino SLEE uses the Apache Log4J logging architecture to provide logging facilities for SLEE components and deployed services.
The Logging Management MBean
Rhino SLEE allows changes to logging configuration at runtime. This is useful for capturing log information to diagnose a problem, without having to restart the SLEE. You configure logging using the |
Logger names
Subsystems within the Rhino SLEE send log messages to specific loggers.
For example, the rhino.facility.alarm
logger periodically receives messages about which alarms are currently active within the Rhino SLEE.
Examples of logger names include:
Log levels
Log levels can be assigned to individual loggers to filter how much information the SLEE produces:
Log level | Information sent |
---|---|
OFF |
No messages sent to logs (not recommended). |
FATAL |
Error messages for unrecoverable errors only (not recommended). |
ERROR |
Error messages (not recommended). |
WARN |
Warning messages. |
INFO |
Informational messages (especially during node startup or deployment of new resource adaptors or services). The default. |
DEBUG |
All log messages. Used for debugging by OpenCloud Rhino SLEE developers. |
Each log level will log all messages for that log level and above. For example, if a logger is set to the INFO level (the default), all of the log messages logged at the INFO, WARN, ERROR, and FATAL levels will be logged as well.
If a logger is not assigned a log level, it inherits its parent’s. For example, if the rhino.management logger has not been assigned a log level, it will have the same effective log level as the rhino logger.
The root logger is a special logger which is considered the parent of all other loggers. By default, the root logger is configured with the INFO log level. In this way, all other logger will output log messages at the INFO log level or above unless explicitly configured otherwise.
Use INFO
A lot of useful or crucial information is output at the INFO log level. Because of this, setting log levels to WARN, ERROR or FATAL is not recommended. |
Log appenders
System administrators can use the console to create log appenders. These append log messages to destinations such as the console, a log file, socket, or Unix syslog daemon. At runtime, when Rhino logs a message (as permitted by the log level of the associated logger), Rhino sends the message to the log appender for writing. Types of log appenders include:
-
file appenders — which append messages to files (and may be rolling file appenders)
-
console appenders — which send messages to the Rhino console
-
custom appenders — which you configure to receive only messages for particular loggers.
Rolling file appenders
Typically, to manage disk usage, administrators are interested in sending log messages to a set of rolling files. They do this by setting up rolling file appenders which:
-
create new log files if the current one gets too large
-
rename old log files as numbered backups
-
delete old logs when a certain number of them have been archived.
(You can configure the size and number of rolled-over log files.)
Default appenders
By default, the Rhino SLEE comes configured with the following appenders active:
Appender | Where it sends messages | Logger name | Type of appender |
---|---|---|---|
RhinoLog |
the Rhino logs directory (work/log/rhino.log) |
root |
a rolling file appender |
STDERR |
the Rhino console where a node is running (in a standard error stream) |
root |
a console appender |
ConfigLog |
work/log/config.log |
rhino.config |
a rolling file appender |
New appenders won’t receive messages until associated with at least one logger
By default, a newly created log appender is not associated with any loggers, so will not receive any log messages. |
Appender additivity
If a logger has its additivity flag set to true, all of the output of its log statements goes to all of its appenders and ancestors. If a specific ancestor has its additivity flag set to false, then the output goes to all appenders and ancestors up to and including that specific ancestor — but not to appenders in any of that ancestor’s ancestors. (By default, logger additivity flags are set to true.}
See also the File Appenders How-to Guide in the OpenCloud Developer Portal and Apache’s short-introduction-to-log4j. |
Tracer objects
SLEE 1.1 provides tracer objects for logging messages from deployed components.
Rhino logs all messages sent to a Tracer under the trace.<tracer name>
logger.
The SLEE 1.1 trace levels are mapped to log4j log levels as shown in the table below.
Tracer log levels
Log levels for trace messages depend on the level at which they are emitted, as follows:
Level emitted | Level logged |
---|---|
FINE, FINER or FINEST |
DEBUG |
CONFIG or INFO |
INFO |
WARNING |
WARNING |
SEVERE |
ERROR |
See also the Tracing Made Easy How-to guide in the OpenCloud Developer Portal. |
SLEE 1.0-based application components can still use the trace facility (defined in the JAIN SLEE 1.0 specification) for logging, however the trace facility has been deprecated for JAIN SLEE 1.1. |