Log4net: write header to each rollover log segment

I have a RollingFileAppender that flips through a log file when it reaches a specific file size. This works great.

Is there a way for log4net to insert a header at the beginning of each newly created log file? Alternatively, is there a way to notify log4net on overflow so that I can write this header myself?

+5
source share
2 answers

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

+3
source

It works:

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

Although it will also write a title if you re-launch the application.

+7

All Articles