为什么log4j在Windows和Linux上正常工作,而相同的配置在Docker中不工作?

时间:2019-01-29 09:21:48

标签: docker tomcat log4j

我使用tomcat作为服务器,log4j可以在Windows和Linux上运行。当我使用Docker部署它时,log4j无法正常工作。而且我发现相关文件夹中未创建任何内容。我在catalina.log中没有发现任何错误。我检查了tmp文件夹的访问权限,并允许写入。您对问题的根源有任何想法吗?谢谢。

log4j.rootLogger=INFO, DailyRolling, Terminal, CONSOLE
#log4j.rootLogger=DEBUG, A1, A2, DailyRolling, Terminal, CONSOLE
log4j.appender.DailyRolling=org.apache.log4j.RollingFileAppender
log4j.appender.DailyRolling.layout=org.apache.log4j.PatternLayout
log4j.appender.DailyRolling.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-7p (%c) %m%n
log4j.appender.DailyRolling.DatePattern='.'yyyy-MM-dd-a

#LINUX
log4j.appender.DailyRolling.File=/tmp/RolingLog.log
log4j.appender.DailyRolling.DatePattern=yyyy-MM-dd'.log'
log4j.appender.DailyRolling.Threshold=INFO
log4j.appender.DailyRolling.BufferedIO=true
log4j.appender.DailyRolling.BufferSize=8192
log4j.appender.DailyRolling.MaxFileSize=20MB
log4j.appender.DailyRolling.MaxBackupIndex=100
log4j.appender.DailyRolling.MaxBackupDay=10

log4j.appender.Terminal=org.apache.log4j.RollingFileAppender
log4j.appender.Terminal.MaxBackupDay=10
#LINUX
log4j.appender.Terminal.File=/tmp/LogConsole.log
log4j.appender.Terminal.layout=org.apache.log4j.PatternLayout
log4j.appender.Terminal.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-7p (%c) %m%n

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.encoding=UTF-8
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.conversionPattern=%d [%t] %-5p %c - %m%n

log4j.logger.httpclient.wire=INFO
log4j.logger.org.apache.commons=INFO
log4j.logger.org.hibernate=WARN
log4j.logger.org.oracle=INFO
log4j.logger.com.mchange.v2=INFO
log4j.logger.org.apache.commons.httpclient=WARN
log4j.logger.org.apache.xerces=ERROR
log4j.logger.org.springframework=INFO

0 个答案:

没有答案