[jboss-user] [Beginners Corner] - logging with log4j under JBoss4

groscurth do-not-reply at jboss.com
Fri Aug 3 07:41:04 EDT 2007


Hi,
 
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"/>
  |       </layout>
  |       <filter class="org.jboss.logging.filter.TCLFilter">
  |          <param name="AcceptOnMatch" value="true"/>
  |          <param name="DeployURL" value="app1.ear"/>
  |       </filter>
  |    </appender>
  |  
  | <root>
  |       <appender-ref ref="CONSOLE"/>
  |       <appender-ref ref="FILE"/>
  |       <appender-ref ref="App1Log"/>
  |    </root>
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 ?
THANKS

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070513#4070513

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070513



More information about the jboss-user mailing list