I am facing a weird situation across all the environments (DEV/UAT/PROD) which i support.
The tomcat support logs gets auto truncate during mid of the day without keeping a backup. There is no consistent time stamp at which it truncates.
1. We are using log4j time based rolling, which is suppose to roll the log file at the end of the day.
2. Cron job is used to move this old log file to Archive.
Both of the above steps are working perfectly good.
But while the logs are getting rolled during the day, it truncates suddenly and i can see that the time stamp fo the start of the file changes.
Tomcat itself does not log using log4j unless you custom-build a Tomcat with that capability. Logging for webapps is entirely managed by each webapp with no co-ordination with the Tomcat server.
So this would be a log4j problem.
The first thing that comes to mind is that the clock managing the logfile truncations is probably UTC, since midnight UTC would be around midday in much of Asia. The reason why the precise time varies could be as simple as statistical variations in the last logged message time before rollover and an opportunistic rollover mechanism. That is one, that rolls over when it's convenient and near rollover time, rather than precisely on schedule.
You might also want to check the log4j docs and see if there's a parameter that can set the rollover time and possibly time precision options.
An IDE is no substitute for an Intelligent Developer.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database