我使用-Dlog4j.configuration=file:C:\repo\application\logs\log4j.properties
为POJO加载Log4J.properties配置并查找文件appender,几乎配置如下:
log4j.logger.com.domain.app.myclass=DEBUG, FILEAPPENDER
log4j.appender.FILEAPPENDER=org.apache.log4j.RollingFileAppender
log4j.appender.FILEAPPENDER.Encoding=UTF-8
log4j.appender.FILEAPPENDER.File==C:/Logs/app_debug.log
log4j.appender.FILEAPPENDER.MaxFileSize=10000KB
log4j.appender.FILEAPPENDER.MaxBackupIndex=10
log4j.appender.FILEAPPENDER.layout=org.apache.log4j.PatternLayout
log4j.appender.FILEAPPENDER.layout.ConversionPattern=%d -- %p -- %c -- %m%n
我得到了
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: =C:\Logs\app_debug.log (The filename, directory name, or volume label syntax is incorrect)
我认为这是错字,但事实并非如此。和许可问题?无论我更改哪个目录,它总是给我java.io.FileNotFoundException some_path_XXXXX (The filename, directory name, or volume label syntax is incorrect)
我错过了什么?
答案 0 :(得分:2)
不确定此行==
log4j.appender.FILEAPPENDER.File==C:/Logs/app_debug.log
的含义
应为log4j.appender.FILEAPPENDER.File=C:/Logs/app_debug.log