0 Replies Latest reply on Oct 22, 2012 3:50 PM by envinyater

    Tried everything to get my log4j.xml file in my Maven Web Project to take over in JBoss 5.1

    envinyater Newbie

      I created a log4j.xml and I inserted it into ../WEB-INF/classes/ Here is the properties file

      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

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

         
      <appender name="fileAppender" class="org.apache.log4j.FileAppender">
             
      <param name="Threshold" value="INFO" />
             
      <param name="file" value="program.log" />
             
      <param name="append" value="true"/>
                 
      <layout class="org.apache.log4j.PatternLayout">
                 
      <param name="ConversionPattern" value="%-5p %c{1} - %m%n" />
             
      </layout>
         
      </appender>

         
      <logger name="com.program">
             
      <level value="debug" />
             
      <appender-ref ref="console"/>
             
      <appender-ref reg="fileAppender" />
         
      </logger>


      </log4j:configuration>

      I have a simple LOG statement in a class that runs at startup. I am seeing that in the console -- so that LOG statement is working fine.

      JBoss 5.1 internal Log4j seems to be taking precedence and nothing I've found online is fixing it.

      Any suggestions I could try and report back or any additional information I need to provide?

      Here is the directory structure:

      src
      ---main
         
      ---java
         
      ---resources
         
      ---webapp
            
      ---META-INF
            
      ---WEB-INF
               
      ---classes
                  
      +log4j.xml
               
      +jboss-deployment-structure.xml

      Maven pom.xml

              <dependency>
             
      <groupId>log4j</groupId>
             
      <artifactId>log4j</artifactId>
             
      <version>1.2.17</version>
             
      <scope>provided</scope>
         
      </dependency>