| Subject: | Contribution - TimestampFileAppender | |
|---|---|---|
| From: | Viktor Bresan (vb_l...@yahoo.com) | |
| Date: | Sep 22, 2006 4:03:10 am | |
| List: | org.apache.logging.log4j-dev | |
| Attachments: | ||
Refine Search
| From | Sent On | Attachments |
|---|---|---|
| Viktor Bresan | Sep 22, 2006 4:03 am | .java, .java, .configuration |
| Subject: | Contribution - TimestampFileAppender | |
|---|---|---|
| From: | Viktor Bresan (vb_l...@yahoo.com) | |
| Date: | Sep 22, 2006 4:03:10 am | |
| List: | org.apache.logging.log4j-dev | |
| Attachments: | ![]() log4j.configuration - 0.5k | |
Hi.
I was looking for an appender that would create the new log file on each start of an application, with the additional request that the file name must contain the current timestamp.
While I was unsuccessfully looking for the appender on the net, I've also found that other people search for the same thing.
Finally, I have decided to write the appender myself. I have tested it, it works fine, and now I am willing to share it.
Appender is pretty simple, it is derived from FileAppender, it has the additional functionality that it replaces "{timestamp}" string from the file name with the current timestamp.
Timestamp pattern is user configured by TimestampPattern property that has the same choice of formats as java.text.SimpleDateFormat
So, I find the solution very flexible.
I have attached the following files:
TimestampFileAppender.java Test.java log4j.configuration
... the actual appender, simple test class and configuration file.
I am waiting for your feedback.
Kind regards, Viktor.
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

