4 Replies Latest reply on Apr 15, 2013 8:42 AM by Claudio Riedi

    Log4j logging works sometimes, sometimes not

    Claudio Riedi Newbie

      I have another jboss 7 - log4j issue

      I'm using jboss 7.1.1.Final standalone and my application consists of a war and several jars within an ear-File.

      The structure looks like this:

      app.ear

          |--- lib

          |       |--- log4j-1.2.16.jar

          |--- META-INF

          |       |--- jboss-deployment-structure.xml

          |--- web.war

          |       |--- WEB-INF

          |                 |--- clasess

          |                          |--- log4j.xml

          |--- mymodule1.jar

          |--- mymodule2.jar

       

      jboss-deployement-structure.xml

       

      {code:xml}

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure>

      <ear-subdeployments-isolated>false</ear-subdeployments-isolated> <deployment>

             <exclusions>

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

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

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

             </exclusions>

             <dependencies>

                  <module name="org.quartz" export="true"/>

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

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

              </dependencies>

        </deployment>

              <sub-deployment name="web.war">

                 <exclusions>

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

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

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

                 </exclusions>

           </sub-deployment>

      </jboss-deployment-structure>

      {code:xml}

       

      Sometimes the logging works perfectly, but after a server restart (without changing the ear) no logs were written.

      But then the following message appears in the server.log

       

      16:28:37,616 ERROR [stderr] (http-127.0.0.1-127.0.0.1-8080-1) log4j:WARN No appenders could be found for logger (ch.treibauf.matchbox.frontend.login.controller.LoginController).

      16:28:37,632 ERROR [stderr] (http-127.0.0.1-127.0.0.1-8080-1) log4j:WARN Please initialize the log4j system properly.

      16:28:37,632 ERROR [stderr] (http-127.0.0.1-127.0.0.1-8080-1) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

       

      I'm confused. Any help is appreciated.