0 Replies Latest reply on Sep 9, 2015 8:35 AM by womuji

    unable to log using log4j for httpclient4.1.3 in JBoss EAP6.0

    womuji

      Hi,


      We are using slf4j&log4j for our web application logging, and we put the log4j.xml file out of our  WAR file so that any changes to the log4j.xml will be read by our scheduler(every 10 min) and take effect without restarting the JBoss server.  The problem we are having is that even after we put the

      <logger name="org.apache.http">

           <level value="DEBUG"/>

      </logger>


      into our log4j.xml, none of the httpclient log is getting logged at all.


      It only works when we add the following line into the standalone.xml:

      <file-handler name="APP_LOG">

            <formatter> <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> </formatter>

           <file path="C:/directoryOutsideJBoss/logs/app.log"/>

            <append value="true"/>

      </file-handler>

      <logger category="org.apache.http">

           <level name="DEBUG"/> <handlers>

           <handler name="APP_LOG"/> </handlers>

      </logger>


      but this solution is not acceptable since we have to restart the JBoss server to have the new logging take effect.  I did pass the following parameter when starting JBoss:

      -Dlog4j.configuration=file:C:\directoryOutsideJBoss\conf\log4j.xml 


      In out WAR/lib directory,  we have:

      • httpclient-4.1.3.jar
      • httpcore-4.1.4.jar
      • log4j-1.2.17.jar
      • slf4j-api-1.7.2.jar
      • slf4j-log4j12-1.7.2.jar 


      Below is our jboss-deployment-structure.xml 


      <jboss-deployment-structure>

        <deployment>

          <exclusions>

            <module name="org.apache.commons.configuration"/>

            <module name="org.apache.log4j" />

            <module name="org.jboss.logging"/>

            <module name="org.slf4j" />

            <module name="org.slf4j.impl" />    

            <module name="org.apache.httpcomponents" />  

          </exclusions>

          <dependencies>

            <module name ="org.apache.commons.lang"/>

            <module name ="org.apache.commons.beanutils"/>

            <module name ="org.apache.commons.codec"/>

            <module name ="org.apache.commons.io"/>

            <module name ="org.javassist"/>

            <module name ="org.picketbox"/>

            <module name ="javax.ws.rs.api"/>

            <module name="org.dom4j" />  

            <module name="org.apache.commons.collections"/>

            <module name="com.google.guava"/>

            <module name="org.apache.cxf" />

            <module name="org.jboss.remote-naming" />

          </dependencies>

        </deployment>

      </jboss-deployment-structure>


      BTW, I tried latest HttpClient4.5, same problem. 


      Thanks in advance. 


      Tony