0

我有一个关键的 tc 服务器 SE 正在运行。部署了一个配置了 log4j2 日志框架的 springboot Web 应用程序。log4j2 属性启用了控制台和文件日志记录,并启用了 TimeBasedTriggeringPolicy,它每天都会创建新文件,并将日期附加到前一个日期。日志记录似乎工作正常,直到最近服务器被关闭进行维护。

问题:服务器启动后,日志不再写入自定义文件(文件日志记录)。我仍然可以看到控制台日志记录发生。重新部署也不能解决问题。

注意:服务器关闭和启动是在不同的日子完成的。不确定这些信息是否重要。

配置状态 = 调试时的 Log4j2 启动日志

2020-01-30 08:39:21,459 background-preinit DEBUG Initializing configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration@63c4d792  
2020-01-30 08:39:21,464 background-preinit DEBUG Installed script engines  
2020-01-30 08:39:22,328 background-preinit DEBUG PluginManager 'Core' found 97 plugins  
2020-01-30 08:39:22,328 background-preinit DEBUG PluginManager 'Level' found 0 plugins  
2020-01-30 08:39:22,333 background-preinit DEBUG No scheduled items  
2020-01-30 08:39:22,335 background-preinit DEBUG Building Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].  
2020-01-30 08:39:22,356 background-preinit DEBUG PluginManager 'TypeConverter' found 23 plugins  
2020-01-30 08:39:22,382 background-preinit DEBUG createProperty(name="filename", value="logs")  
2020-01-30 08:39:22,383 background-preinit DEBUG Building Plugin[name=properties, class=org.apache.logging.log4j.core.config.PropertiesPlugin].  
2020-01-30 08:39:22,393 background-preinit DEBUG configureSubstitutor(={filename=logs}, Configuration(LoggingConfig))  
2020-01-30 08:39:22,394 background-preinit DEBUG PluginManager 'Lookup' found 13 plugins  
2020-01-30 08:39:22,396 background-preinit DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].  
2020-01-30 08:39:22,396 background-preinit DEBUG createAppenderRef(ref="StdoutAppender", level="null", Filter=null)  
2020-01-30 08:39:22,397 background-preinit DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].  
2020-01-30 08:39:22,399 background-preinit DEBUG createAppenderRef(ref="DailyRollingAppender", level="null", Filter=null)  
2020-01-30 08:39:22,399 background-preinit DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].  
2020-01-30 08:39:22,401 background-preinit DEBUG createLogger(additivity="null", level="INFO", includeLocation="null", ={StdoutAppender, DailyRollingAppender}, ={}, Configuration(LoggingConfig), Filter=null)  
2020-01-30 08:39:22,405 background-preinit DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].  
2020-01-30 08:39:22,406 background-preinit DEBUG createLoggers(={root})    
2020-01-30 08:39:22,406 background-preinit DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].  
2020-01-30 08:39:22,414 background-preinit DEBUG PatternLayout$Builder(pattern="%d{ISO8601} [%t] %-5p (%F:%L) - %m%n", PatternSelector=null, Configuration(LoggingConfig), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")  
2020-01-30 08:39:22,415 background-preinit DEBUG PluginManager 'Converter' found 41 plugins  
2020-01-30 08:39:22,452 background-preinit DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender].  
2020-01-30 08:39:22,456 background-preinit INFO Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory.  
2020-01-30 08:39:22,457 background-preinit DEBUG PluginManager 'Converter' found 41 plugins  
2020-01-30 08:39:22,464 background-preinit DEBUG Starting OutputStreamManager SYSTEM_OUT.false-2  
2020-01-30 08:39:22,471 background-preinit DEBUG ConsoleAppender$Builder(PatternLayout(%d{ISO8601} [%t] %-5p (%F:%L) - %m%n), Filter=null, target="null", name="StdoutAppender", follow="null", ignoreExceptions="null")  
2020-01-30 08:39:22,488 background-preinit DEBUG Starting OutputStreamManager SYSTEM_OUT.false  
2020-01-30 08:39:22,488 background-preinit DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].  
2020-01-30 08:39:22,490 background-preinit DEBUG PatternLayout$Builder(pattern="%d{ISO8601} [%t] %-5p (%F:%L) - %m%n", PatternSelector=null, Configuration(LoggingConfig), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")  
2020-01-30 08:39:22,491 background-preinit DEBUG Building Plugin[name=TimeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy].  
2020-01-30 08:39:22,494 background-preinit DEBUG createPolicy(interval="1", modulate="null")  
2020-01-30 08:39:22,495 background-preinit DEBUG Building Plugin[name=Policies, class=org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy].  
2020-01-30 08:39:22,495 background-preinit DEBUG createPolicy(={TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false)})  
2020-01-30 08:39:22,496 background-preinit DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.RollingFileAppender].  
2020-01-30 08:39:22,499 background-preinit DEBUG createAppender(fileName="logs/App.log", filePattern="logs/App-%d{yyyy-MM-dd-hh-mm}.log", append="null", name="DailyRollingAppender", bufferedIO="null", bufferSize="null", immediateFlush="null", Policies(CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false)])), Strategy=null, PatternLayout(%d{ISO8601} [%t] %-5p (%F:%L) - %m%n), Filter=null, ignoreExceptions="null", advertise="null", advertiseURI="null", Configuration(LoggingConfig))  
2020-01-30 08:39:22,509 background-preinit DEBUG Starting RollingFileManager logs/App.log  
2020-01-30 08:39:22,524 background-preinit DEBUG PluginManager 'FileConverter' found 2 plugins  
2020-01-30 08:39:22,527 background-preinit DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].  
2020-01-30 08:39:22,528 background-preinit DEBUG createAppenders(={StdoutAppender, DailyRollingAppender})  
2020-01-30 08:39:22,529 background-preinit DEBUG Configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration@63c4d792 initialized  
2020-01-30 08:39:22,530 background-preinit DEBUG Starting configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration@63c4d792  
2020-01-30 08:39:22,530 background-preinit DEBUG Started configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration@63c4d792 OK.  
2020-01-30 08:39:22,531 background-preinit DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false-1  
2020-01-30 08:39:22,531 background-preinit DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration@44b5581b OK  
2020-01-30 08:39:22,551 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75  
2020-01-30 08:39:22,554 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75,component=StatusLogger  
2020-01-30 08:39:22,556 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75,component=ContextSelector  
2020-01-30 08:39:22,558 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75,component=Loggers,name=  
2020-01-30 08:39:22,572 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75,component=Appenders,name=StdoutAppender  
2020-01-30 08:39:22,572 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75,component=Appenders,name=DailyRollingAppender  
2020-01-30 08:39:22,578 background-preinit DEBUG Reconfiguration complete for context[name=29647f75] at URI NULL_SOURCE (org.apache.logging.log4j.core.LoggerContext@19276473) with optional ClassLoader: null  
2020-01-30 08:39:22,579 background-preinit DEBUG Shutdown hook enabled. Registering a new one.  
2020-01-30 08:39:22,580 background-preinit DEBUG LoggerContext[name=29647f75, org.apache.logging.log4j.core.LoggerContext@19276473] started OK.  
2020-01-30 08:39:22,629 background-preinit DEBUG RollingFileManager executing synchronous FileRenameAction[logs/App.log to logs/App-2020-01-30-08-36.log, renameEmptyFiles=false]
4

0 回答 0