我的配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
<!-- appender-ref ref="outToFile" /-->
<appender-ref ref="CONSOLE" />
</appender>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d] - %c{1}.%t %-5p (%F:%L) - %m%n" />
</layout>
</appender>
<appender name="outToFile" class="org.apache.log4j.FileAppender">
<param name="File" value=".\\log\\log.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss,SSS}(%t)] %-5p %c -%m%n" />
</layout>
</appender>
<root>
<priority value="debug" />
<appender-ref ref="ASYNC" />
</root>
</log4j:configuration>
测试类输出:
[2006-11-26 14:49:52,281] - CheckEmail.main INFO (?:?) - 这是一个测试
但其中的(%F:%L)却没有起作用,这是什么原因?