I post this question here because of a hint of Remko Popma.
I want to add some custom info at the top of each logfile, like the version string of my application, the application uptime and the system uptime. And even writing some »bye, bye / eof« to the bottom of the just closed logfile would also be fine.
Because there is no appropriate hook or callback to get notified when the RollingFileAppander is creating / has created a new file, so that I can put my things at first into these new logfile, I tried to extend DefaultRolloverStrategy. But currently, I stuck at some points.
Seems that I have to deal with @Plugin and @PluginFactory. My try with the attached log4j2.xml and MyRolloverStrategy.java compiles without errors and warnings. But when I start the application, I get this error message:
2014-01-05 23:22:05,876 ERROR RollingFile contains an invalid element or attribute "MyRolloverStrategy"
And then the next step would be: "how to write to the logfiles within my rollover method?"