log4j2 is logging to console only and not logging to a file after server shutdown/startup

386 views Asked by At

I have a pivotal tc server SE running. There is a springboot web app deployed with log4j2 logging framework configured. The log4j2 properties has console and file logging enabled with TimeBasedTriggeringPolicy enabled which creates new file every day with the date appended to the previous date. The logging seemed to be working fine until recently where the server was taken down for maintenance.

Issue: The logs are not being written to custom file(File logging) anymore after the server startup. I can still see console logging happen. Re-deploy isn't fixing the problem too.

Note: The server shutdown and startup was done on different days. Not sure if this information matters.

Log4j2 startup logs when Configuration status = debug

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]
0

There are 0 answers