• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Rolling log files every hour irrespective of logging event

 
Ranch Hand
Posts: 41
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic