3 Replies Latest reply on Jul 30, 2013 11:40 AM by mattso

    log4j.xml not getting loaded under 7.1.2 (EAP 6.1-Alpha)

    mattso

      Dear all,

       

        I am in the process of upgrading my stack from JBoss 3.2.6 to 7.1.2 (yes, it's been a long time) I have read the discussions in this forum concerning log4j / JBoss 7 but but seems like the log4j.xml gets ignored no matter what I did.  Here is what I have:

       

        My deployment is a 'SAR', and inside the SAR I have all the jars that I wanted to load + a META-INF directory that includes:

      1) jboss-service.xml, which list out all the mbeans I wanted to load in my SAR)

      2) jboss-deployment-descriptor.xml, which list out all the jars that I wanted to load + global modules dependence + exclusion of the following modules:

          <exclusions>

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

                  <module name="org.slf4j" />

                  <module name="org.log4j"/>

          </exclusions>

      3) log4j.xml that I was using in my JBoss 3.2.6

       

      I have modified my standalone.sh to include the following system variable "jboss.server.home.dir" (which was being used in my log4j.xml)

      I am able to get the SAR deployed successfully and all the mbean accessible via lynx.  However, I see no log generated at the log file location I specified in my log4j.xml

       

      To make sure that the log4j.xml is getting loaded, I also played with the following ideas but none of them works:

      1) Pack the log4j.xml into one of the jar that gets loaded (specified in jboss-deployment-descriptor.xml)

      2) Place the log4j.xml under standalone/configuration (same location as logging.properties)

       

        Thanks for your help!

       

      Matthew

        • 1. Re: log4j.xml not getting loaded under 7.1.2 (EAP 6.1-Alpha)
          mattso

          Update:  I have add the following properties to my standalone.sh after placing the log4j.xml under my standalone/configuration directory:

           

          -Dorg.jboss.as.logging.per-deployment=false

          -Dlog4j.configuration=$JBOSS7_HOME/standalone/configuration/log4j.xml

           

          and now I have different error messages:

           

          18:44:31,989 ERROR [stderr] (MSC service thread 1-6) log4j:WARN No appenders could be found for logger (com.abc.mbean.ListenerImpl).

          18:44:31,990 ERROR [stderr] (MSC service thread 1-6) log4j:WARN Please initialize the log4j system properly.

           

          Since, I am deploying SAR, not WAR or EAR, so I don't have any classes or lib folder.  But then again, I have already tired place the log4j.xml under META-INF or pack it as a jar and add that to jboss-deployment-structure.xml.  None works unfortunately.

           

             Thanks in advance for your help!

           

          Matthew

          • 2. Re: log4j.xml not getting loaded under 7.1.2 (EAP 6.1-Alpha)
            ybxiang.china

            Why NOT use JBoss logging and  forget Log4j(it is complicated(at least NOT easy) to config it in both JBoss AS 7 and Glassfish 3+, because both container invented their own logger)?

            (Or use JDK Logging?)

            JBoss logging is good enough.

            • 3. Re: log4j.xml not getting loaded under 7.1.2 (EAP 6.1-Alpha)
              mattso

                The reason is we have different appender implementation based on different business requirement (ie certain modules' logging is based on count, while some are based on size or day of the week, etc.)

                BTW, I would also like to know if JBoss 7 allow exclusions of module dependency under modules.  From the DTD it seems there's no way to exclude anything, but would like to confirm.  Thanks!

               

              Matthew