2 Replies Latest reply on Aug 8, 2007 4:51 AM by Andreas Groscurth

    logging with log4j under JBoss4

    Andreas Groscurth Newbie


      i'd like to use log4j.xml to log a web application in a seperate file

      According to JBOSS the following has to be added to the log4j.xml

      <appender name="App1Log" class="org.apache.log4j.FileAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
       <param name="Append" value="false"/>
       <param name="File" value="${jboss.server.home.dir}/log/app1.log"/>
       <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
       <filter class="org.jboss.logging.filter.TCLFilter">
       <param name="AcceptOnMatch" value="true"/>
       <param name="DeployURL" value="app1.ear"/>
       <appender-ref ref="CONSOLE"/>
       <appender-ref ref="FILE"/>
       <appender-ref ref="App1Log"/>

      which I did (with my .war file)

      in the application i tried :
      private static Logger LOGGER = Logger.getLogger( GetApplicationsServlet.class );
       private static Logger LOGGER2 = Logger.getRootLogger();

      and printed out some error messages.

      JBoss logs normal on the console and in the server.log. It also creates the app1.log file but without any content :(

      What is wrong.. why does it log not in the file but anywhere else ?