[ https://issues.apache.org/jira/browse/LOG4J2-491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joe Merten updated LOG4J2-491: ------------------------------ Description: vvI want this callbacks 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. See also: * [#486|LOG4J2-486] * [http://stackoverflow.com/questions/20819376/log4j2-rollingfile-appender-add-custom-info-at-the-start-of-each-logfile] Currently I need to extend DefaultRolloverStrategy and wrap around RolloverDescription and appender.rolling.helper.Action to place my code (and therefore I also have to copy some factory code of DefaultRolloverStrategy to support all config parameters etc.). Ok, this approach currently works but it needs ~150 lines of code and is maintenance-unfriendly eg. if DefaultRolloverStrategy gets more config parameters in future versions. The callbacks should provide at least the filename of the related logfile. An access to the configured Layout of the related appender would also helpful, so that the custom info could be correctly formatted (e.g. incl. timestamp or matching for xml etc.). I think there sould be 2 callbacks * 1st one for after all outstanding writes to the old logfile has been done (so thet I could add some stuff to the end of the old file), but before things like compressing are performed * 2nd one for to write my stuff to the top of the new logfile was: vvI want this callbacks 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. See also: * [#486|LOG4J2-486] * [http://stackoverflow.com/questions/20819376/log4j2-rollingfile-appender-add-custom-info-at-the-start-of-each-logfile] Currently I need to extend DefaultRolloverStrategy and wrap around RolloverDescription and appender.rolling.helper.Action to place my code (and therefore I also have to copy some factory code of DefaultRolloverStrategy to support all config parameters etc.). Ok, this approach currently works but it needs ~150 lines of code and is maintenance-unfriendly eg. if DefaultRolloverStrategy gets more config parameters in future versions. The callbacks should provide at least the filename of the related logfile. An access to the configured Layout of the related appender would also helpful, so that the custom info could be correctly formatted (e.g. incl. timestamp etc.). I think there sould be 2 callbacks * 1st one for after all outstanding writes to the old logfile has been done (so thet I could add some stuff to the end of the old file), but before things like compressing are performed * 2nd one for to write my stuff to the top of the new logfile > RollingFile Appender - callbacks when rolling > ---------------------------------------------- > > Key: LOG4J2-491 > URL: https://issues.apache.org/jira/browse/LOG4J2-491 > Project: Log4j 2 > Issue Type: Wish > Components: Appenders > Affects Versions: 2.0-beta9 > Environment: Java 1.7, Linux > Reporter: Joe Merten > > vvI want this callbacks 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. > See also: > * [#486|LOG4J2-486] > * > [http://stackoverflow.com/questions/20819376/log4j2-rollingfile-appender-add-custom-info-at-the-start-of-each-logfile] > Currently I need to extend DefaultRolloverStrategy and wrap around > RolloverDescription and appender.rolling.helper.Action to place my code > (and therefore I also have to copy some factory code of > DefaultRolloverStrategy to support all config parameters etc.). Ok, this > approach currently works but it needs ~150 lines of code and is > maintenance-unfriendly eg. if DefaultRolloverStrategy gets more config > parameters in future versions. > The callbacks should provide at least the filename of the related logfile. > An access to the configured Layout of the related appender would also > helpful, so that the custom info could be correctly formatted (e.g. incl. > timestamp or matching for xml etc.). > I think there sould be 2 callbacks > * 1st one for after all outstanding writes to the old logfile has been done > (so thet I could add some stuff to the end of the old file), but before > things like compressing are performed > * 2nd one for to write my stuff to the top of the new logfile -- This message was sent by Atlassian JIRA (v6.1.5#6160) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org