1 Reply Latest reply on Oct 27, 2004 12:37 PM by Misak Boulatian

    apache commons-logging stopped working under jboss 4.0

    Misak Boulatian Newbie

      We hava been using jboss 3.2.3 for some time. I tried to migrate to jboss 4.0. One thing I notice that logging does not work in jboss 4.0. I cannot get logging to work from our applications. All appenders are setup properly but things that worked in 3.2.3 don't work under jboss 4.0. We use jakarta commons logging as a wrapper to the jboss log4j service. I have commons-logging.jar file in the server/[server name]/lib directory. Here is my log4j.xml file in the conf directory.

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
      
      <!-- ===================================================================== -->
      <!-- -->
      <!-- Log4j Configuration -->
      <!-- -->
      <!-- ===================================================================== -->
      
      <!-- $Id: log4j.xml,v 1.26.2.1 2004/09/19 22:18:42 starksm Exp $ -->
      
      <!--
       | For more configuration infromation and examples see the Jakarta Log4j
       | owebsite: http://jakarta.apache.org/log4j
       -->
      
      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
      
       <!-- ================================= -->
       <!-- Preserve messages in a local file -->
       <!-- ================================= -->
      
       <!-- A time/date based rolling appender -->
       <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
       <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
       <param name="Append" value="true"/>
      
       <!-- Rollover at midnight each day -->
       <param name="DatePattern" value="'.'yyyy-MM-dd"/>
      
       <!-- Rollover at the top of each hour
       <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
       -->
      
       <layout class="org.apache.log4j.PatternLayout">
       <!-- The default pattern: Date Priority [Category] Message\n -->
       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
      
       <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
       <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
       -->
       </layout>
       </appender>
      
       <!-- ============================== -->
       <!-- Append messages to the console -->
       <!-- ============================== -->
      
       <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
       <param name="Target" value="System.out"/>
       <param name="Threshold" value="INFO"/>
      
       <layout class="org.apache.log4j.PatternLayout">
       <!-- The default pattern: Date Priority [Category] Message\n -->
       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
       </layout>
       </appender>
      
       <!-- ============================ -->
       <!-- Setup Volts Logger Appenders -->
       <!-- ============================ -->
      
       <!-- The volts syslog appender
       <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
       <param name="Facility" value="LOCAL5"/>
       <param name="FacilityPrinting" value="true"/>
       <param name="SyslogHost" value="loghost"/>
       <param name="Threshold" value="ERROR"/>
      
       <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%-8r %d{ISO8601} [%t] %-5p %c - %m%n"/>
       </layout>
       </appender>
       -->
      
       <!-- The volts.log appender -->
       <appender name="VoltsAppender" class="org.jboss.logging.appender.DailyRollingFileAppender">
       <param name="File" value="${jboss.server.home.dir}/log/volts.log"/>
       <param name="Append" value="true"/>
       <param name="Threshold" value="DEBUG"/>
      
       <!-- Rollover at midnight each day -->
       <param name="DatePattern" value="'.'yyyy-MM-dd"/>
      
       <layout class="org.apache.log4j.PatternLayout">
       <!-- Time in ms since startup, date in ISO format, thread name, priority, category name, message data -->
       <param name="ConversionPattern" value="%-8r %d{ISO8601} [%t] %-5p %c - %m%n"/>
       </layout>
       </appender>
      
       <!-- The voltscustomer.log appender -->
       <appender name="VoltsCustomerAppender" class="org.jboss.logging.appender.RollingFileAppender">
       <param name="File" value="${jboss.server.home.dir}/log/voltscustomer.log"/>
       <param name="Append" value="false"/>
       <param name="MaxFileSize" value="20480KB"/>
       <param name="MaxBackupIndex" value="30"/>
       <param name="Threshold" value="DEBUG"/>
      
       <layout class="org.apache.log4j.PatternLayout">
       <!-- Time in ms since startup, date in ISO format, thread name, priority, category name, message data -->
       <param name="ConversionPattern" value="%d{ISO8601}\t%p\t%c\t%m%n"/>
       </layout>
       </appender>
      
       <!-- The volts processed execution messages appender -->
       <appender name="VoltsExecutionMessagesAppender" class="org.jboss.logging.appender.DailyRollingFileAppender">
       <param name="File" value="${jboss.server.home.dir}/log/ExecutionMessages.log"/>
       <param name="Append" value="true"/>
       <param name="Threshold" value="INFO"/>
      
       <!-- Rollover at midnight each day -->
       <param name="DatePattern" value="'.'yyyy-MM-dd"/>
      
       <!-- Rollover at the top of each hour
       <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
       -->
      
       <layout class="org.apache.log4j.PatternLayout">
       <!-- The default pattern: Date Priority [Category] Message\n -->
       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
      
       <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
       <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
       -->
       </layout>
       </appender>
      
       <!-- The volts open order batch reconciliation appender -->
       <appender name="VoltsOpenOrderReconciliationAppender" class="org.jboss.logging.appender.DailyRollingFileAppender">
       <param name="File" value="${jboss.server.home.dir}/log/OpenOrderReconciliation.log"/>
       <param name="Append" value="true"/>
       <param name="Threshold" value="INFO"/>
      
       <!-- Rollover at midnight each day -->
       <param name="DatePattern" value="'.'yyyy-MM-dd"/>
      
       <!-- Rollover at the top of each hour
       <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
       -->
      
       <layout class="org.apache.log4j.PatternLayout">
       <!-- The default pattern: Date Priority [Category] Message\n -->
       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
      
       <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
       <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
       -->
       </layout>
       </appender>
      
       <!-- =================== -->
       <!-- Setup Volts Loggers -->
       <!-- =================== -->
      
       <category name="com.vantra.volts">
       <priority value="DEBUG" />
       <!--appender-ref ref="VoltsAppender"/-->
       </category>
       <category name="voltscustomer" additivity="false">
       <priority value="INFO" />
       <appender-ref ref="VoltsCustomerAppender"/>
       </category>
       <category name="execution.messages" additivity="false">
       <priority value="INFO" />
       <appender-ref ref="VoltsExecutionMessagesAppender"/>
       </category>
       <category name="openorder.reconciliation" additivity="false">
       <priority value="INFO" />
       <appender-ref ref="VoltsOpenOrderReconciliationAppender"/>
       </category>
      
       <!--
       <logger name="com.vantra.volts">
       <level value="DEBUG" />
       <appender-ref ref="VoltsAppender"/>
       </logger>
       <logger name="voltscustomer" additivity="false">
       <level value="INFO" />
       <appender-ref ref="VoltsCustomerAppender"/>
       </logger>
       <logger name="execution.messages" additivity="false">
       <level value="INFO" />
       <appender-ref ref="VoltsExecutionMessagesAppender"/>
       </logger>
       <logger name="openorder.reconciliation" additivity="false">
       <level value="INFO" />
       <appender-ref ref="VoltsOpenOrderReconciliationAppender"/>
       </logger>
       -->
      
       <!-- ================ -->
       <!-- Limit categories -->
       <!-- ================ -->
      
       <!-- Limit JBoss categories to INFO -->
       <category name="org.jboss">
       <priority value="INFO"/>
       </category>
       <category name="org.apache">
       <priority value="INFO"/>
       </category>
       <!-- Limit the org.jgroups category to WARN as its INFO is verbose -->
       <category name="org.jgroups">
       <priority value="WARN"/>
       </category>
       <!-- Limit apache axis to INFO as its DEBUG is even more verbose -->
       <category name="org.apache.axis">
       <priority value="INFO"/>
       </category>
       <!-- Limit the JSR77 categories -->
       <category name="org.jboss.management">
       <priority value="INFO"/>
       </category>
      
       <!-- Enable all JDBC SQL statements with values passed around
       <category name="org.jboss.ejb.plugins.cmp.jdbc">
       <priority value="TRACE" class="org.jboss.logging.XLevel"/>
       <appender-ref ref="VoltsAppender"/>
       </category>
       -->
      
       <!-- Limit JBoss webservice category
       <category name="org.jboss.webservice">
       <priority value="DEBUG"/>
       </category>
       -->
      
       <!-- Decrease the priority threshold for the org.jboss.varia category
       <category name="org.jboss.varia">
       <priority value="DEBUG"/>
       </category>
       -->
      
       <!-- Show the evolution of the DataSource pool in the logs [inUse/Available/Max]
       <category name="org.jboss.resource.connectionmanager.JBossManagedConnectionPool">
       <priority value="TRACE" class="org.jboss.logging.XLevel"/>
       </category>
       -->
      
       <!--
       | An example of enabling the custom TRACE level priority that is used
       | by the JBoss internals to diagnose low level details. This example
       | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
       | subpackages. This will produce A LOT of logging output.
       <category name="org.jboss.system">
       <priority value="TRACE" class="org.jboss.logging.XLevel"/>
       </category>
       <category name="org.jboss.ejb.plugins">
       <priority value="TRACE" class="org.jboss.logging.XLevel"/>
       </category>
       -->
      
       <!--
       | Logs these events to SNMP:
       - server starts/stops
       - cluster evolution (node death/startup)
       - When an EJB archive is deployed (and associated verified messages)
       - When an EAR archive is deployed
      
       <category name="org.jboss.system.server.Server">
       <priority value="INFO" />
       <appender-ref ref="TRAP_LOG"/>
       </category>
      
       <category name="org.jboss.ha.framework.interfaces.HAPartition.lifecycle">
       <priority value="INFO" />
       <appender-ref ref="TRAP_LOG"/>
       </category>
      
       <category name="org.jboss.deployment.MainDeployer">
       <priority value="ERROR" />
       <appender-ref ref="TRAP_LOG"/>
       </category>
      
       <category name="org.jboss.ejb.EJBDeployer">
       <priority value="INFO" />
       <appender-ref ref="TRAP_LOG"/>
       </category>
      
       <category name="org.jboss.deployment.EARDeployer">
       <priority value="INFO" />
       <appender-ref ref="TRAP_LOG"/>
       </category>
      
       -->
      
      
       <!-- ======================= -->
       <!-- Setup the Root category -->
       <!-- ======================= -->
      
       <root>
       <appender-ref ref="CONSOLE"/>
       <appender-ref ref="FILE"/>
       <!--appender-ref ref="SYSLOG"/-->
       </root>
      
       <!-- Clustering logging -->
       <!-- Uncomment the following to redirect the org.jgroups and
       org.jboss.ha categories to a cluster.log file.
      
       <appender name="CLUSTER" class="org.jboss.logging.appender.RollingFileAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
       <param name="File" value="${jboss.server.home.dir}/log/cluster.log"/>
       <param name="Append" value="false"/>
       <param name="MaxFileSize" value="500KB"/>
       <param name="MaxBackupIndex" value="1"/>
      
       <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
       </layout>
       </appender>
       <category name="org.jgroups">
       <priority value="DEBUG" />
       <appender-ref ref="CLUSTER"/>
       </category>
       <category name="org.jboss.ha">
       <priority value="DEBUG" />
       <appender-ref ref="CLUSTER"/>
       </category>
       -->
      
      </log4j:configuration>
      


      Appreciate the response,
      Misak

        • 1. Re: apache commons-logging stopped working under jboss 4.0
          Misak Boulatian Newbie

          Hi,

          I figured out myself. Here is the explanation if someone gets the same problem. There is a new package under deploy directory called ebxmlrr-service.sar. Apparently, this package contains commons-logging.properties file that specifies NoOpLog as an implementation for the logger that stops all the logging from jakarta commons. The solution is to create commons-logging.properties file and drop it under the server/[server name]/lib directory with the following contents:

          org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger


          This is, of course, if you want to use log4j as an underlying mechanism.
          Thanks,
          Misak