3 Replies Latest reply on May 10, 2010 1:09 AM by Vineet S

    How to set up Log4J.properties in JBoss 5.1.0?

    Dejan Mratinkovic Newbie

      I have my own Log4j.properties file, placed in the root of my ear file, set up as described here:http://www.jboss.org/feeds/post/how_do_i_use_my_own_log4j_properties_or_xml_file_in_jboss

       

      On Jboss 4.2.3 ti all works fine. Now I want to migrate application to Jboss 5.1, but log4j.properties seem to be ignored.

       

      Should I initialize log4j somehow, or do anything else? In  4.2.3 all worked out of the box, without me doing anything else except placing the file into the root of application.

        • 1. Re: How to set up Log4J.properties in JBoss 5.1.0?
          jaikiran pai Master

          The log4j config file is expected to be in the classpath of the application. I guess the root of the .ear used to be in the classpath for 4.2.x.

           

          For AS-5, try moving that file to .ear/lib folder (if you don't have an .ear/lib folder, then create one). See if that works.

          • 2. Re: How to set up Log4J.properties in JBoss 5.1.0?
            Dejan Mratinkovic Newbie

            Nothing changed when I have moved file to lib.

             

            I guess almost all enterprise applications have log4j set up some how. Anyone got it working? Is my problem just file placement or could it be something else, ie. initialize/configure Log4j from my code?

             

            Can someone confirm it is enough to put file on classpath, or there is more to it?

            • 3. Re: How to set up Log4J.properties in JBoss 5.1.0?
              Vineet S Newbie

              I'm not sure if this response comes in late to you. But you can follow the steps to acheive that

              1. Package ur log4j.properties inside the EAR so that it is available in the Classpath e.g Root or EAR/libs. Additionally you can also place it inside App-inf/libs but just that in the latter case make sure to have this

               

              <library-directory>APP-INF/lib</library-directory> 

              in your jboss-app.xml.

               

              2. Over-ride the class-loading(isolation). Like this

              <loader-repository>

               

              com.blahblah:archive=blahblah.ear

               

              <loader-repository-config>

              java2ParentDelegation=false

               

              </loader-repository-config>

               

              </loader-repository>

               

               

               

               

               

               

              3. Package the log4j.jar(ur choice) inside the EAR somewhere @places mentioned in pt.1

              4. You are done