You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by pradeep <pr...@jgsullivan.com> on 2001/08/22 21:11:46 UTC

how do u set the daily rolling file appender in xml config file

hi guy i need to have a rollover file created at the end of each day.im 
using DomConfigurator with xmlconfig file
could u suggest me how to achieve that .i know that i need to use 
DailyRollingFileAppender
thx
pradeep.
here is my java code:
       strXmlfile=ResourceManager.getResource(LOG_FILE_LOCATION, null);
       log4j=Category.getInstance(OemsSystemLog.class.getName());
       DOMConfigurator.configure(strXmlfile);

here is my xmlconfig file:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This file is the configuartion files for all logging activities -->
<!-- This file prints int  a file called oemssys.log-->
<!-- To print the o/p to console comment the section  'FILE  COMMENTS START 
HERE'
     AND uncomment 'CONSOLE'.The default is file o/p.-->
<!-- SEARCH FOR 'DEBUG' and follow the instruction to disable log message-->
  <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

  <!--CONSOLE-->
<!-- <appender name="systemlog" class="org.apache.log4j.ConsoleAppender">-->

  <!--FILE  COMMENTS START HERE-->
<appender name="systemlog" class="org.apache.log4j.FileAppender">-->
  <param name="File" value="C:/projects/oemsv2/logout/oemsys.log" />
<!--FILE END COMMENTS HERE-->
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} | 
%C{1} | %-5p | - %m\n" />
   </layout>
  </appender>


  <category name="com.oems.util.OemsSystemLog">
  <!--DEBUG change the value to fatal if u need to disable log messages -->
   <priority value="info" />
   </category>
<root>
<priority value="info"  />
   <appender-ref ref="systemlog" />
   </root>

   </log4j:configuration>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org