Log4j not appending file extension

2019-09-10 09:37发布

I've set my log4j.properties file to this configuration below

log4j.rootLogger=INFO, CATALINA

# Define all the appenders
log4j.appender.CATALINA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.CATALINA.File=${catalina.base}/logs/catalina.
log4j.appender.CATALINA.Append=true
log4j.appender.CATALINA.Encoding=UTF-8
# Roll-over the log once per day
log4j.appender.CATALINA.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.CATALINA.layout = org.apache.log4j.PatternLayout
log4j.appender.CATALINA.layout.ConversionPattern = %d [%t] %-5p %c- %m%n

The issue is when creating my logs (I'm using OS x Lion and Tomcat 6.0.32), the logs are created without the extension, just a final dot.

However, if I use this same configuration in a Windows box, it does the work OK.

1条回答
萌系小妹纸
2楼-- · 2019-09-10 10:15
log4j.appender.CATALINA.File=${catalina.base}/logs/catalina.

needs to be:

log4j.appender.CATALINA.File=${catalina.base}/logs/catalina.log
查看更多
登录 后发表回答