I need NLog to overwrite the log file when the application is restarted. Currently it appends to existing file. For example I have something like this in my NLog.config
<targets>
<target xsi:type="File" name="fileLog"
fileName="${longdate}.log" layout="${message}" />
</targets>
It would be nice if I was able to add to <target>
something like this append="false"
so instead of appending to existing log it would overwrite.
replace your config section
<targets>
<target xsi:type="File" name="fileLog"
fileName="${longdate}.log" layout="${message}" deleteOldFileOnStartup="true"/>
</targets>
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