The logging system is configured by a combination of two OSGi Admin PIDs and one configuration file:
etc/system.properties—the configuration file that sets the logging level during the container’s boot process. The file contains a single property, org.ops4j.pax.logging.DefaultServiceLog.level, that is set toERRORby default.org.ops4j.pax.logging—the PID used to configure the logging back end service. It sets the logging levels for all of the defined loggers and defines the appenders used to generate log output. It uses standard Log4j configuration. By default, it sets the root logger's level toINFOand defines two appenders: one for the console and one for the log file.![[Tip]](imagesdb/tip.gif)
Tip The console's appender is disabled by default. To enable it, add
log4j.appender.stdout.append=trueto the configuration For example, to enable the console appender in a standalone container, you would use the following commands:FuseESB:karaf@root>config:edit org.ops4j.pax.loggingFuseESB:karaf@root>config:propappend log4j.appender.stdout.append trueFuseESB:karaf@root>config:updateorg.apache.karaf.log.cfg—configures the output of the log console commands.
The most common configuration changes you will make are changing the logging levels, changing the threshold for which an appender writes out log messages, and activating per bundle logging.
The default logging configuration sets the logging levels so that the log file will provide enough information to monitor the behavior of the runtime and provide clues about what caused a problem. However, the default configuration will not provide enough information to debug most problems.
The most useful logger to change when trying to debug an issue with Fuse ESB Enterprise is the root
logger. You will want to set its logging level to generate more fine grained messages. To do
so you change the value of the org.ops4j.pax.logging PID's
log4j.rootLogger property so that the logging level is one of the following:
TRACEDEBUGINFOWARNERRORFATALNONE
Example 22 shows the commands for setting the root loggers log level in a standalone container.
Example 22. Changing Logging Levels
FuseESB:karaf@root>config:edit org.ops4j.pax.loggingFuseESB:karaf@root>config:propset log4j.rootLogger "DEBUG, out, osgi:VmLogAppender"FuseESB:karaf@root>config:update
When debugging a problem in Fuse ESB Enterprise you may want to limit the amount of logging
information that is displayed on the console, but not the amount written to the log file.
This is controlled by setting the thresholds for each of the appenders to a different
level. Each appender can have a
log4j.appender. property that
controls what level of messages are written to the appender. The appender threshold values
are the same as the log level values.appenderName.threshold
Example 23 shows an example of setting the root
logger to DEBUG but limiting the information displayed on the console to
WARN.
Example 23. Changing the Log Information Displayed on the Console
FuseESB:karaf@root>config:edit org.ops4j.pax.loggingFuseESB:karaf@root>config:propset log4j.rootLogger "DEBUG, out, osgi:VmLogAppender"FuseESB:karaf@root>config:propappend log4j.appender.stdout.threshold WARNFuseESB:karaf@root>config:update
It is possible to reconfigure Fuse ESB Enterprise logging so that it writes one log file for each
bundle, instead of writing all of the log messages into a single log file. This feature is
enabled by adding the Log4j sift appender to the Log4j root logger as shown in
Example 24.
Example 24. Enabling Per Bundle Logging
FuseESB:karaf@root>config:edit org.ops4j.pax.loggingFuseESB:karaf@root>config:propset log4j.rootLogger "INFO, out, sift, osgi:VmLogAppender"FuseESB:karaf@root>config:update
After restarting the container, you can see that each
BundleName bundle now has its own log file, located at
data/log/.BundleName.log
This is the behavior you will see with the default sift appender settings. You can edit
this behavior using the sift appender configuration settings in
org.ops4j.pax.logging.cfg.








