0 Replies Latest reply on May 3, 2005 5:21 PM by Bryan Barkley

    commons-logging Configuration Problem

    Bryan Barkley Newbie

      I've been waiting for the release of 4.0.2 hoping that it would solve a problem that I'm having that is similar to this thread. I'm trying to use commons-logging with log4j using my own log4j.xml config file, but JBoss (or Tomcat?) doesn't seem to want to cooperate.

      I've set up a scoped class loader as detailed on the logging wiki page, and have downloaded the sample log4j.war file. It works fine, but it uses log4j directly. Grrr, not what I'd like...

      Here's portion of the log4j.xml file I have working in the log4j.war app:

      <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
       <param name="Target" value="System.out"/>
       <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c:%L - %m%n"/>
       <priority value="debug"/>
       <appender-ref ref="STDOUT"/>

      I've changed the snoop.jsp as follows:
      private Log myLog = LogFactory.getLog("foo");
      .... // log4j Logger log already defined in file

      I see the log4j statement printed to the console, but not the commons-logging one.

      Is there any way around this? According to the JIRA issue that this relates to it seems that 4.0.2 simply ignores any commons-logging jars in the webapp's lib dir. Does this mean that it's using a jar from JBoss or Tomcat's classloader, which is in turn using a log4j library in the same scope?

      Thanks for any assistance.