Re: [Log4cplus-devel] Header line for file appenders
Logging Framework for C++
Brought to you by:
wilx
|
From: Václav Z. <vha...@gm...> - 2014-01-29 09:38:48
|
On 28 January 2014 23:13, Steve Hartmann wrote:
> Hello all,
>
> I have recently run into a situation in which it would have been really
> convenient if the file appenders had some way to add a header line to the
> top of each file.
This is an interesting idea. I am not opposed to adding this feature
to log4cplus.
> I don't mind doing the coding for this, but first wanted
> to throw the idea out there to see if someone else may have a better idea
> for implementation.
>
> My plan was to simply add an attribute to the file appenders named something
> like "FileHeader" which would contain a string. That string would be
> inserted as the first line in each file. For example:
>
> log4cplus.temperatureLogger=DEBUG, A2
> log4cplus.appender.A2=log4cplus::DailyRollingFileAppender
> log4cplus.appender.A2.File=log/temperature
> log4cplus.appender.A2.layout=log4cplus::PatternLayout
> log4cplus.appender.A2.Schedule=DAILY
> log4cplus.appender.A2.MaxBackupIndex=2
> log4cplus.appender.A2.FileHeader=Date Temperature1 Setpoint1 Temperature2
> Setpoint2%n
> log4cplus.appender.A2.layout.ConversionPattern=%D{%Y-%m-%d %H:%M:%S.%q}
> %m%n
>
> Or should this be implemented in the layout?
It seems to me that layout would be a better place for this.
Is there a prior art for this feature in log4j (or any other Java
logging library) or log4net, etc.? We could copy their design
decisions / interfaces.
|