logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Viktor Bresan <vb_log4j_...@yahoo.com>
Subject Contribution - TimestampFileAppender
Date Fri, 22 Sep 2006 11:03:33 GMT
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 
Mime
View raw message