如何使用一个log4j配置文件创建2个单独的日志文件?
我不知道如何配置我的log4j,以便我的debugLog和我的reportLog彼此分开(不是附加的)。为什么在以下配置中,reportsLog始终为空? log4j.rootLogger=TRACE, stdout, debugLog log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n log4j.appender.debugLog=org.apache.log4j.FileAppender log4j.appender.debugLog.File=logs/debug.log log4j.appender.debugLog.layout=org.apache.log4j.PatternLayout log4j.appender.debugLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n log4j.reportsLog=DEBUG,reportsLog log4j.appender.reportsLog=org.apache.log4j.FileAppender log4j.appender.reportsLog.File=logs/reports.log log4j.appender.reportsLog.layout=org.apache.log4j.PatternLayout log4j.appender.reportsLog.layout.ConversionPattern=%d [%24F:%t:%L] - %m%n 这是我的Java代码: package test; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; public class HelloLogger { static final Logger debugLog = Logger.getLogger("debugLog"); static final Logger resultLog = Logger.getLogger("reportsLog"); public static …