[jboss-user] [Beginners Corner] - Re: Log Size

jaikiran do-not-reply at jboss.com
Thu Oct 12 06:22:23 EDT 2006


Here's the xml configuration:

<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
  | 
  | <!-- ===================================================================== -->
  | <!--                                                                       -->
  | <!--  Log4j Configuration                                                  -->
  | <!--                                                                       -->
  | <!-- ===================================================================== -->
  | 
  | <!-- $Id: log4j.xml,v 1.13.2.8 2003/09/23 14:16:27 slaboure Exp $ -->
  | 
  | <!--
  |    | For more configuration infromation and examples see the Jakarta Log4j
  |    | owebsite: http://jakarta.apache.org/log4j
  |  -->
  | 
  | <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
  | 
  |    <!-- ================================= -->
  |    <!-- Preserve messages in a local file -->
  |    <!-- ================================= -->
  | 
  |    <!-- A size based rolling appender -->
  |    <appender name="FILE" class="org.apache.log4j.FileAppender">
  |      <param name="File" value="D:/log/myLog.log"/>
  |      <param name="Append" value="false"/>
  |      <param name="MaxFileSize" value="50MB"/>
  |      <param name="MaxBackupIndex" value="100"/>
  | 
  |      <layout class="org.apache.log4j.PatternLayout">
  |        <param name="ConversionPattern" value="%d{ISO8601} [%X{TAPUSERNAME}] %-5p [%c] %m%n"/>
  |      </layout>	   
  |    </appender>
  | 
  | 
  |    
  |    <!-- ============================== -->
  |    <!-- Append messages to the console -->
  |    <!-- ============================== -->
  | 
  |    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
  |       <param name="Target" value="System.out"/>
  |       <param name="Threshold" value="INFO"/>
  | 
  |       <layout class="org.apache.log4j.PatternLayout">
  |          <!-- The default pattern: Date Priority [Category] Message\n -->
  |        <param name="ConversionPattern" value="%d{ISO8601}  %-5p [%c{1}] %m%n"/>
  |       </layout>
  |    </appender>
  | 
  |    <!-- ================ -->
  |    <!-- Limit categories -->
  |    <!-- ================ -->
  | 
  |    
  |    <category name="org.myapp">
  |        <priority value="DEBUG" />
  |        <appender-ref ref="FILE"/>
  |    </category>
  | 
  | 
  | 
  |    
  |    <!-- ======================= -->
  |    <!-- Setup the Root category -->
  |    <!-- ======================= -->
  | 
  |    <root>
  |       <appender-ref ref="CONSOLE"/>
  |    </root>
  | 
  | </log4j:configuration>

You can set the "MaxFileSize" and "MaxBackupIndex" and any other attribute values depending on your needs

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

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



More information about the jboss-user mailing list