5 Replies Latest reply on Apr 29, 2013 10:21 AM by petal1

    JBoss AS 6 and Log4j

    petal1 Newbie

      Hello,

      I know there are plenty of posts out there on this topic, but I am not finding any of them helpful or relevant.

      I have a simple requirement. I am moving from JBoss AS 4.0.4 to JBoss AS 6. In my 4.0.4 environment I have a log4j.xml in server/myconfig/conf folder, and log4j.jar in server/myconfig/lib. I realise that JBoss AS 6 has changed to a native logging framework. We are heavily dependent on log4j and changing is not practical. I have seen many posts saying to package log4j jar and the log4j.xml file in your application. I have dozens of jar and war files in deploy and lib. Would I seriously be expected to package the log4j.jar and log4j.xml into all of them? I would hope not, so maybe setting -Djboss.as.logging.per-deployment=false will help? But I still see people saying to put log4j.jar and log4j.xml into ear/war files even with that set.

      I have tried putting log4j.jar in server/myconfig/lib with a log4j.xml file in server/myconfig/conf. I have also tried adding a log4j-appender to server/deploy/jboss-logging.xml as follows:

         <log4j-appender name="MYFILE" class="org.apache.log4j.RollingFileAppender">

            <error-manager>

               <only-once/>

            </error-manager>

       

            <level name="DEBUG"/>

       

            <properties>

               <property name="File">${jboss.server.log.dir}/serverX.log</property>

               <property name="MaxFileSize">20MB</property>

               <property name="MaxBackupIndex">5</property>

            </properties>

       

            <formatter>

               <pattern-formatter pattern="%d %-5p [%c] (%t) %m%n"/>

            </formatter>

       

         </log4j-appender>

       

         <root-logger>

            <level name="${jboss.server.log.threshold:INFO}"/>

            <handlers>

               <handler-ref name="CONSOLE"/>

               <handler-ref name="FILE"/>

               <handler-ref name="MYFILE"/>

            </handlers>

         </root-logger>

       

      but that didn't work. In fact, with the above addition to jboss-logging.xml, I did not get anything written to server.log, which I do without the above.

      If someone could please tell me how I can mimic my 4.0.4 set up please then I'd be very grateful.

      Thanks,

      Paul

        • 1. Re: JBoss AS 6 and Log4j
          petal1 Newbie

          Is there no-one that is able and/or willing to help with this question? I can't believe it is so unbelievably difficult / impossible to upgrade from JBoss 4 to JBoss 6.

          All I want is to have log4j working as it used to. Can the JBoss developers really be so bad that they have not provided a way of doing that, and clear documentation of how to do it?

          • 2. Re: JBoss AS 6 and Log4j
            Stan Silvert Master

            I think "unwilling" is the problem.  I know that's unfortunate, but nobody I know of works on AS6 any more.  Why aren't you using AS7?  I'm sure you can get lots of help with that.

             

            Stan

            • 3. Re: JBoss AS 6 and Log4j
              Stan Silvert Master

              Or maybe you mean EAP6?

              • 4. Re: JBoss AS 6 and Log4j
                petal1 Newbie

                Hi,

                No, I did mean AS6. The reason for upgrading to AS6 rather than AS7 is because I have read on the forums that AS6 supports EJB2.x without having to jump through hoops, but AS7's support for EJB2.x is poor / non-existant. As we have thousands of beans, a requirement of the upgrade is that no code changes are required.

                Cheers,

                Paul

                • 5. Re: JBoss AS 6 and Log4j
                  petal1 Newbie

                  I'm still trying to get an answer to what should be an extremely simple problem. I have moved to version 6.1.0.Final of JBoss, but cannot realistically move any higher as the resource required to move to JBoss 7 would be prohibitive.

                  So, on 6.1.0.Final - would someone PLEASE tell me how to get all my Jars (deploy and lib), Sars (deploy), and Wars (deploy) to use log4j rather than JBoss logging. And preferably without having to amend all the jars/sars/wars if at all possible.

                  Thank you.