我正在尝试配置 log4j2.properties
文件,以便将我的日志写入文件。这是我的配置:
appender.file.type = File
appender.file.name = FileLogger
appender.file.filename = /usr/share/foo/mylogfile.log
appender.file.layout.type = PatternLayout
appender.file.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
rootLogger.level = info
rootLogger.appenderRef.file.ref = FileLogger
不幸的是我得到的是
main ERROR Null object returned for File in Appenders.
main ERROR Unable to locate appender "FileLogger" for logger config "root"