1 2 Previous Next 19 Replies Latest reply on Apr 20, 2012 5:24 PM by Andrej Podgorsek

    Log4j properties file not working

    Andrej Podgorsek Newbie

      Hi. I can not get log4j to work on JBoss 7.1.1.Final. I have defined a fileappender and while it creates the log file correctly, but with 0bytes and everything goes to server.log instead of application.log file

       

      My pom config is as follows

       

      <dependency>

                            <groupId>log4j</groupId>

                            <artifactId>log4j</artifactId>

                            <version>1.2.14</version>

                           </dependency>

       

      and I've also added something I found on forums

       

      <build>

            <plugins>

               <plugin>

                  <artifactId>maven-war-plugin</artifactId>

                  <version>2.1.1</version>

                  <configuration>

                     <!-- Java EE 6 doesn't require web.xml, Maven needs to catch

                        up! -->

                        <archive>

                                                                  <manifestEntries>

                                                                             <Dependencies>org.apache.log4j</Dependencies>

                                                                  </manifestEntries>

                                                        </archive>

                     <failOnMissingWebXml>false</failOnMissingWebXml>

                  </configuration>

               </plugin>

            </plugins>

         </build>

       

      Ive also found something on topic of jboss-deployment-structure.xml

       

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

      <jboss-deployment-structure>

        <deployment>

          <exclusions>

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

          </exclusions>

        </deployment>

      </jboss-deployment-structure>

       

      And the external properties file which I can see in logs is read and also creates C:/logs/project/project.log

       

      log4j.rootCategory=INFO, file

      log4j.appender.file=org.apache.log4j.FileAppender

      log4j.appender.file.layout=org.apache.log4j.PatternLayout

       

      log4j.appender.file.layout.ConversionPattern=%d %-5p (%13F:%L) %3x => %m%n

      log4j.appender.file.File=C:/logs/project/project.log

      log4j.category.com.myorganisation=INFO

        1 2 Previous Next