Zeev
Zeev

Reputation: 55

log4j2 CustomAppender to rename the completed file and to append some data string

As I've asked on an another topic

I'm trying to do achieve something not quite standard from the log4j2 capabilities while using the RollingFile and TimeBasedTriggeringPolicy options.

After completion of the currently written file and before a new one is created, I would like to insert the Completed_HHmmss timestamp to the completed filename and append to it the following file's description. Since these actions may require some Java code activation, I suppose that a CustomAppender will be required.

Thanks

Upvotes: 0

Views: 380

Answers (1)

Zeev
Zeev

Reputation: 55

Perhaps a following solution could be implemented:

While the current file is updated, a regular RollingFileAppender is used, and upon the completion some CustomAppender will be activated. This CustomAppender will insert the Completed_MMddyyyy string into the file's name and will append the subsequent file's description to the completed file.

Is it feasible ? How should I define and implement such a CustomAppender ?

Thanks

Upvotes: 0

Related Questions