atom feed1 message in org.apache.logging.log4j-devContribution - TimestampFileAppender
FromSent OnAttachments
Viktor BresanSep 22, 2006 4:03, .java, .configuration
Subject:Contribution - TimestampFileAppender
From:Viktor Bresan (
Date:Sep 22, 2006 4:03:33 am
log4j.configuration - 0.5k


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: log4j.configuration

... the actual appender, simple test class and configuration file.

I am waiting for your feedback.

Kind regards, Viktor.