log4j.xml :
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="true"
xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} %5p %c{1} - %m%n"/>
</layout>
</appender> <appender name="fileAppender" class="org.apache.log4j.RollingFileAppender">
<param name="append" value="true"/>
<param name="file" value="logs/logging.log"/>
<param name="MaxFileSize" value="100kb" />
<param name="MaxBackupIndex" value="5" />
<!-- <param name="threshold" value="fatal" /> -->
<layout class="org.apache.log4j.PatternLayout">
<!-- <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>-->
<param name="ConversionPattern" value="%d - %c - %p - %m%n"/>
</layout>
</appender>
<root>
<level value="INFO"/>
<appender-ref ref="consoleAppender"/>
<appender-ref ref="fileAppender"/>
</root>
</log4j:configuration>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="true"
xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} %5p %c{1} - %m%n"/>
</layout>
</appender> <appender name="fileAppender" class="org.apache.log4j.RollingFileAppender">
<param name="append" value="true"/>
<param name="file" value="logs/logging.log"/>
<param name="MaxFileSize" value="100kb" />
<param name="MaxBackupIndex" value="5" />
<!-- <param name="threshold" value="fatal" /> -->
<layout class="org.apache.log4j.PatternLayout">
<!-- <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>-->
<param name="ConversionPattern" value="%d - %c - %p - %m%n"/>
</layout>
</appender>
<root>
<level value="INFO"/>
<appender-ref ref="consoleAppender"/>
<appender-ref ref="fileAppender"/>
</root>
</log4j:configuration>
No comments:
Post a Comment