我的项目一启动就收到 StackOverFlowError。我见过其他类似的问题,答案是未指定 lg4j.xml 或格式不正确,但这里似乎并非如此。这是代码:
public static void main( String[] args )
{
// Configure Logger
DOMConfigurator.configure("config/log4j.xml");
logger.info("Starting StudyImporter");
}
这是 log4j.xml 文件:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss,SSS} - [%t] %-5p %c %x - %m%n" />
</layout>
</appender>
<!-- log all logs to a separate log file every day -->
<appender name="MAIN_FA" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="C:/project/logs/main.log" />
<param name="datePattern" value="'-'yyyy-MM-dd'.log'" />
<param name="append" value="true" />
<!-- <param name="Threshold" value="INFO" /> -->
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
</layout>
</appender>
<logger name="org.importadorestudios">
<level value="INFO" />
</logger>
<root>
<level value="INFO" />
<appender-ref ref="CONSOLE" />
<appender-ref ref="MAIN_FA" />
</root>
摇曳的蔷薇
尚方宝剑之说
相关分类