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:

<level value="INFO"/>

to this:

<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:

 
<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:

 
<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 level.