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 there 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?

Answers


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


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.


Need Your Help

Android Error: SDK23 v SDK19 - java.lang.NoClassDefFoundError: com.google.android.gms.R$string

java android google-play-services

My Android app uses Google Maps and compiles fine for both an SDK23 and SDK19 device. It runs fine on the SDK23 (LG G4) but generates this error SDK19 device (Samsung Galaxy 4) => java.lang.

Microsoft SQL Server (MSSQL) updatable view with multiple base tables and full performance

sql function view sql-server-2008-r2 updatable-views

I am using MSSQL 2008 R2. It has the handy feature of updatable views. For example if I have one table t mapping id to name: