Guten Tag Oscar Pernas,
am Montag, 19. Januar 2015 um 13:00 schrieben Sie:
> I would like to add a header to each log file when the logfile
> rotates. There is any way to do it? is there any callback thrown when
> the log rotates?
It looks to me you need to implement your own RollingPolicy, because
those provide RolloverDescription-Objects which can provide additional
actions to do and those actions would be want you want to implement to
get things done. Have a look at TimeBasedRollingPolicy:
> RolloverDescriptionPtr TimeBasedRollingPolicy::initialize(
[...]
> ActionPtr noAction;
>
> if (currentActiveFile.length() > 0) {
> return new RolloverDescription(
> currentActiveFile, append, noAction, noAction);
> } else {
> bRefreshCurFile = true;
> return new RolloverDescription(
> lastFileName.substr(0, lastFileName.length() - suffixLength), append,
> noAction, noAction);
> }
You would need to implement a substitute for noAction.
http://logging.apache.org/log4cxx/apidocs/classlog4cxx_1_1rolling_1_1_rolling_policy.html
http://logging.apache.org/log4cxx/apidocs/classlog4cxx_1_1rolling_1_1_rollover_description.html
http://logging.apache.org/log4cxx/apidocs/classlog4cxx_1_1rolling_1_1_action.html
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail: [email protected]
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow