• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Rolling log files every hour irrespective of logging event

 
Ranch Hand
Posts: 41
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi JavaRanch,

I am currently using the log4j-1.2.16.jar for my logging purpose in my application.
My requirement is to create a file with some tracking logs of the events occurred in my application, create a backup log file every hour and use that log file for monitoring.

As default by using DatePattern we can create a backup log file every hour, and its working pretty good for me.

But the problem occurs only when the logging event doesn't occur.
The backup file is not getting created.until the logging event occurs in the next hour. The previous data is still in the original logging file which is not rolling by itself.

Is there any possibility that the file gets rolled over irrespective of logging event.
Even if the application is idle for 2 days the file should get rolled over every hour.

while searching i came across an appender which is org.apache.log4j.appender.TimeAndSizeRollingAppender which supports only for log4j-1.2.15.jar
So i downloaded, updated my dependency to 1.2.15 and updated my configuration file as below.



Even if declared its getting rolled only when log event occurs.

Kindly help me in this issue.

Thanks in Advance.
 
Do you pee on your compost? Does this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!