I have a configuration for log4net as follows:
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="C:\...\log-file.txt" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<header value ="Start new file proccessing..."/>
<conversionPattern value="%newline%date - %message%exception" />
<footer value ="Finish with the proccessing"/>
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
And it works fine but I wish I could add a new line after my footer, so when I append more than once to my log file the footer from the previous run doesn't stay on the same line with the begining (header) of the second run.
Example:
Operation started..
....
Operation endedOperationStarted
....
Operation ended
I wish I could make it look like:
Operation started..
....
Operation ended
OperationStarted
....
Operation ended
Append
to your header / footer value, i.e. <footer value ="Finish "/>
(see log4net documentation)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With