1 Reply Latest reply on Feb 6, 2007 11:08 PM by Russ

    log4j and Jboss-4.0.5 GA

    Laiwu Luo Newbie

      I have a question on using log4j in JBoss-4.0.5 environment. I have "log4j.properties" file under my web application /WEB_INF/classes directory as follows:

      # Set root logger level to error, and specify a file appender
      log4j.rootLogger=error, File

      ###### File appender definition #######
      log4j.appender.File=org.apache.log4j.RollingFileAppender
      log4j.appender.File.File=c:/logs/myApp.log
      log4j.appender.File.MaxFileSize=50MB
      log4j.appender.File.MaxBackupIndex=1
      log4j.appender.File.layout=org.apache.log4j.PatternLayout
      log4j.appender.File.layout.ConversionPattern=%d{MM/dd/yyyy HH:mm:ss z} %-5p [%c(1)] (%F:%L) %m%n

      log4j.logger.com.covisint.hie=DEBUG


      But the entry in the log file does not correctly show the file name (Welcome.java) and its line number (see below):

      01/02/2007 16:32:52 EST INFO [Welcome] (Log4JLogger.java:94) forward to "Welcome.jsp"

      Is there any JBoss configuation I need do to make loj4j works as expected?

      Thanks,

      Laiwu



        • 1. Re: log4j and Jboss-4.0.5 GA
          Russ Newbie

          Checkout the log4j.xml file. I am doing the same (moved from properties file to xml file)

          <!-- A time/date based rolling appender -->
           <appender name="PROD" class="org.jboss.logging.appender.RollingFileAppender">
           <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
           <param name="File" value="${jboss.server.home.dir}/log/product.log"/>
           <param name="Append" value="false"/>
          
          
           <!-- Rollover at midnight each day -->
           <param name="DatePattern" value="'.'yyyy-MM-dd"/>
          
           <!-- Rollover at the top of each hour
           <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
           -->
          
           <layout class="org.apache.log4j.PatternLayout">
           <!-- The default pattern: Date Priority [Category] Message\n -->
           <param name="ConversionPattern" value="[%d][%t] [%5p] [%m]%n"/>
           </layout>
           </appender>
          
          



          Cheers,

          Russ