• 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

Compressing Files using log4j

 
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hi All,

We are using log4j 1.2.x. Our requirement is to roll the log file based on size and the old files need to be compressed. How can we go ahead and use this in log4j..

Thanks in advance..

Regards
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The just-closed log file, you would want it compressed immediately? Then you would write a subclass of RollingFileAppender (or whichever class satisifies your requirements except for compression) and insert code to do the compression.

Personally I don't compress my old log files for a week. Somebody might want to look at them, after all, and why make it inconvenient for them?
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Currently the log4j is configured to have 300 MB file log & max backup of 1..But the logging goes beyond the 1.5GB and hence there is overwriting of the log files and we dont see all the requests for the day. The option of increasing the disk size is quite a long one to have on the prod boxes.

Hence can we configure through log4j so that it will zip the logs files after it reaches a particular size limit ;also at the same time continuing to log.

Regards

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic