Modifying Log Output

dcm4chee is deployed within the JBoss application server.  All logging configuration (what log levels are used, where log files go, etc.) can be edited in <dcm4chee_home>/server/default/conf/jboss-log4j.xml.  The JBoss site has some great documentation on logging within the system, but here are some dcm4chee-specific tips.

Log output

By default, dcm4chee log output goes to the console as well as a file.  The log file is named server.log, and can be found here: <dcm4chee_home>/server/default/log.  To change this (so, for example, log messages do not go to the console), edit the following section in your jboss-log4j.xml file:

<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->

   <appender-ref ref="CONSOLE"/>
   <appender-ref ref="FILE"/>

 If I were to comment out the CONSOLE appender, then all messages would be logged to the file.

The actual file settings are found in this block of jboss-log4j.xml:

<appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
     <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
     <param name="Append" value="false"/>
     <param name="MaxFileSize" value="10000KB"/>
     <param name="MaxBackupIndex" value="10"/>

     <layout class="org.apache.log4j.PatternLayout">
         <!-- The default pattern: Date Priority CallingAET->CalledAET (Thread) [Category] Message\n -->
         <param name="ConversionPattern" value="%d %-5p %X{calling}->%X{called} (%t) [%c] %m%n"/>
  • To change the location (or name) of the log file, edit the value of the File parameter.
  • The log files will roll.  To change the max size of the log files that are created, edit the MaxFileSize value.
  • Since the log files roll over, you can change the number of log files to keep on hand.  For this you can edit the MaxBackupIndex value.
  • You can use <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender"> for date/time based rolling - see presetting in jboss-log4j.xml.

Generally you want to keep enough log files on hand so that you can troubleshoot an issue, even if you are not aware of the issue until later.

Log Levels

By default, all of the logging categories are set to the INFO level.   This is a good level which allows you to read the log and understand what is going on without being flooded with information.  If an error should occur, or you need to investigate something, it is a good idea to drop the logging for a particular category (or categories) down to the DEBUG level.  This will print out a lot of detail.  The DEBUG logging level is not recommended for production use except for short periods of time though as it can dramatically affect performance.  Likewise, if everything is running smooth, a slight performance gain can be realized by changing the log levels to only log WARN messages, or ERROR messages.

To edit the log levels for the different categories, edit this section of your jboss-log4j.xml file:

<!-- Limit the org.dcm4chex.arr to INFO -->
   <category name="org.dcm4chex.arr">
      <priority value="INFO"/>

   <!-- Limit the org.infohazard category to INFO -->
   <category name="org.infohazard">
      <priority value="INFO"/>

   <!-- Limit the org.dcm4chex.archive category to INFO -->
   <category name="org.dcm4chex.archive">
      <priority value="INFO"/>

   <!-- Limit the org.dcm4chex.wado to INFO -->
   <category name="org.dcm4chex.wado">
      <priority value="INFO"/>

   <!-- Limit the org.dcm4cheri category to INFO -->
   <category name="org.dcm4cheri">
      <priority value="INFO"/>

   <!-- Limit the org.apache category to INFO -->
   <category name="org.apache">
      <priority value="INFO"/>

   <!-- Limit JBoss categories to INFO
        Modify INFO to FATAL to hide error messages from jboss components -->
   <category name="org.jboss">
     <priority value="INFO"/>

 The different categories are explained as follows:

  • org.dcm4chex.arr - Audit Record Repository log category.
  • org.infohazard - The Maverick web application framework log category.
  • org.dcm4chex.archive - The dcm4chee archive log category.
  • org.dcm4chex.wado - The dcm4chee WADO log category.
  • org.dcm4cheri - The dcm4che14 DICOM toolkit log category.
  • org.apache - The Apache Tomcat log category.
  • org.jboss - The JBoss application server log category.

Additionally to get SQL Commands in your log file you can add the following category to your jboss-log4j.xml:

 <category name="org.jboss.ejb.plugins.cmp.jdbc">
      <priority value="DEBUG"/>

Changing the priority value for any of these log categories will change the output for those software components.  This file may be changed on the fly, with modifications being picked up within a minute of saving the file.

Changing Log Levels via JMX

Log levels can be also changed by the JMX Console Web Application using a standard web browser:

  1. Follow the link to the JMX MBean View of the Log4jService in the JMX Agent View:
  2. Invoke operation void setLoggerLevel() with specified logger/category name and logger level:

Alternatively, the operation can be invoked using the command line tool twiddle:

<dcm4chee_home>/bin/ -uadmin -padmin invoke \
      jboss.system:service=Logging,type=Log4jService \
      setLoggerLevel org.jboss DEBUG

(warning) Such changes of Log Levels are not persistent and will be reset with next reboot of the application.