开发者

log4net: writing a header to each rollover log segment

I have a RollingFileAppender that rolls over the log file when it reaches a specified file size. This works great.

Is the开发者_运维知识库re a way to have log4net insert a header at the top of each newly created log file? Alternatively, is there a way to be notified by log4net when a roll over occurs so that I can write this header myself?


This seems to work:

<layout type="log4net.Layout.PatternLayout">
     <header value="[Header]&#13;&#10;" />
     <conversionPattern value=" ... " />
</layout>

Though it will also write the header if you re-start the application.


I think you may have to extend an appender or write your own appender for this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜