01.
log4j.appender.file=org.apache.log4j.FileAppender02.
log4j.appender.file.File=C:/logfile.log03.
log4j.appender.file.layout=org.apache.log4j.PatternLayout04.
log4j.appender.file.layout.ConversionPattern=%d %c [%t] %-2p %c -%m%n
File Appender configuration in log4j.xml
01.
<?xml version="1.0" encoding="UTF-8" ?>02.
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">03.
04.
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">05.
<!-- File Appender -->06.
<appender name="file" class="org.apache.log4j.FileAppender">07.
<param name="File" value="log/file.log"/>08.
<param name="Append" value="true"/>09.
<layout class="org.apache.log4j.PatternLayout">10.
<param name="ConversionPattern" value="%-5p%c{1}-%m%n"/>11.
</layout>12.
</appender>13.
14.
<root>15.
<priority value ="debug"/>16.
<appender-ref ref="file"/>17.
</root>18.
</log4j:configuration>