• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Append date in RollingFileAppender

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to use RollingFileAppender to rollover my log files when they reach a
particular size. But, instead of renaming the files "filename.log.1" I would
like them to be renamed "filename.log.date" (with the date appended). Is there any way this can be done? please post your suggestions

Thanks in Advance,
venky
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think RollingFileAppender can do that. But if you write a class that extends it, it shouldn't be hard to have it rename the file any way you want (the rollover method is public and can be overwritten).
 
Sheriff
Posts: 28370
99
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 DailyRollingFileAppender does exactly that. And you wouldn't want the date to be part of the filename like that if you weren't rolling the log files daily, would you?
 
Venkatesh Sandrasegaran
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Clapham:
The DailyRollingFileAppender does exactly that. And you wouldn't want the date to be part of the filename like that if you weren't rolling the log files daily, would you?




Think you are getting things in a different way. i want DailyRollingFileAppender to work in a different way, i want to do the job exactly what it does with the condition on size of the file. DailyRollingFileAppender does this way, on the end of the day it rolls out as Application.log.2007-06-17 i want this rollout to happened when the size exceeds 250 MB and roll out as
Application.log.2007-06-17.1 , Application.log.2007-06-17.2 etc....

Thanks in advance,
 
Venkatesh Sandrasegaran
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
I don't think RollingFileAppender can do that. But if you write a class that extends it, it shouldn't be hard to have it rename the file any way you want (the rollover method is public and can be overwritten).



Thanks for the reply, i will try and let you know...
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic