How to configure logging since Pustefix 1.0.0
Starting with Pustefix 1.0.0 the logging configuration has been removed from the Pustefix code. This means that the "pfixlog.xml" does not exist any longer.
Pustefix itself as well as various libraries use the log4j and Apache Commons Logging APIs for logging.
While there is no need to use a certain logging software, there is a recommendation that is based on our experience with logging in an OSGi environment.
Recommended logging solution
We recommend using LOGBack for logging within the OSGi container. LOGBack has a flexible configuration and exposes its functions using the SLF4J API.
As SLF4J provides bridges for the log4j as well as the Apache Commons Logging APIs, LOGBack works with existing code using one of these APIs. In order to enable these bridges you have to install jcl-over-slf4j.jar and log4j-over-slf4j.jar instead of the original log4j and Commons Logging libraries.
LOGBack is configured by attaching a fragment bundle with the configuration file to the LOGback bundle. The fragment bundle has to specify a Fragment-Host header with the value ch.qos.logback.logback-classic and the LOGBack configuration file named logback.xml in the root of the bundle.
A very simple LOGBack configuration, writing all messages of level warn and error to standard output and discarding all other messages, is shown below:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<root level="warn">
<appender-ref ref="STDOUT" />
</root>
</configuration>
For more complex configuration examples have a look at the LOGback documentation.
