Reputation: 400
I am looking for a checklist of some kind, that would help me in solving the below problem:
I have a webapp running on Tomcat 8. I use Log4J2 v2.1 and Apache Commons Logging v1.2. My applications logs fine for a few days, then abruptly the logging stops. There aren't any exceptions being logged. Nothing!
I am unable to understand why this happens and what could be root cause. Also I don't know how to work towards finding the root cause.
BTW, the system has enough free disk space ~500GB and the tomcat logs, like localhost_access logs and others continue to log uninterrupted.
EDIT: As requested, posting the log4j2 configuration -
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%p [%t] %c{1}.%M(%L) | %m%n"/>
</Console>
<RollingFile name="RollingFile" fileName="../logs/app.log"
filePattern="../app/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout>
<Pattern>%d{ISO8601} [REQ_ID|%X{REQUEST_UUID}] %p [%t] %c{1}.%M(%L) | %m%n</Pattern>
</PatternLayout>
<Policies>
<OnStartupTriggeringPolicy/>
<TimeBasedTriggeringPolicy interval="6" modulate="true"/>
<SizeBasedTriggeringPolicy size="5 MB"/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<Logger ... />
...
<Root level="debug">
<AppenderRef ref="RollingFile"/>
</Root>
</Loggers>
</Configuration>
Upvotes: 0
Views: 835
Reputation: 328584
The usual culprit here is that the file is renamed by a log rotation tool. If it happens after a few days, then the log rotation tool is configured to move the file away when it has reached a certain size. The tools then often compress the log file.
What happens is:
Solution: Configure log rotation in your Java logging tool or configure it to work together with the external log rotation tool.
Upvotes: 1