Is it possible to include a carriage-return and or linefeed in an NLog layout. I wish to hold the following format of header information in all my logs:
Application Name: <Application Name>
File Version: <Version number>
Released: <Release date>
User: <Windows User>
etc...
21|17:07:54|domain\user|Trace| System.OverflowException: Arithmetic operation
resulted in an overflow at application.form.Button1_Click(Object sender,
EventArgs e) in D:\Documents and
Settings\user\Mydocuments\workarea\application\application
project\application.vb:line 47
All assistance much appreciated
Regards
Paul J.
NLog has a ${newline}
LayoutRenderer that will add a newline to the output.
If you want the "header" to only appear once in the log file (or once per run), you might want to see this question as well:
Nlog - Generating Header Section for a log file
This answer also describes adding a header to an NLog log file:
https://stackoverflow.com/a/4259447/125439
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