Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Changing the Logging in ServiceMix

ServiceMix uses Log4j by way of Apache Commons Logging for logging purposes. Via the Log4J configuration, the logging can be almost completely customized to suit your needs. Below are a couple of common changes people need right away. For any additional changes and for more information on Log4J, see the Log4J manual.

Step One: Change the Root Level

Edit the conf/log4j.xml file and change the root level on or around line #66 from this:

Code Block

<level value="INFO"/>

to this:

Code Block

<level value="DEBUG"/>

Step Two: Change an Appender

There are two appenders provided by default in the conf/log4j.xml file - one named CONSOLE and another named FILE. The CONSOLE appender has its threshold set to INFO by default. If you'd like the logging output to the console to be the debug level logging, change the CONSOLE appender from this:

Code Block
 
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
  <param name="threshold" value="INFO"/>
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%-5p - %-30c{1} - %m%n"/>
  </layout>
</appender>

to this:

Code Block
 
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
  <param name="threshold" value="DEBUG"/>
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%-5p - %-30c{1} - %m%n"/>
  </layout>
</appender>

Notice that the only element that was changed was the threshold parameter. This change allows the logging output to the console to be at the debug levelWe use commons-logging to log information in the broker client and the broker itself. So, you can fully configure which logging levels are used and whether to log to files or the console etc. For more information see the log4j manual.