2. log4j.xml 파일에 다음 내용을 추가합니다.
코드 11-7 log4j.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
...
<!-- 파일에 출력하기 -->
<appender name="monitor" class="org.apache.log4j.RollingFileAppender">
<param name="append" value="false"/>
<param name="maxFileSize" value="10KB"/>
<param name="maxBackupIndex" value="5"/>
<!-- For Tomcat -->
<param name="file" value="c:/logs/monitor.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="info"/>
<param name="LevelMax" value="info"/>
</filter>
</appender>