是否可以在NLog布局中包含回车符和换行符.我希望在所有日志中保存以下格式的标头信息:
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
Run Code Online (Sandbox Code Playgroud)
所有的帮助非常感谢
问候
保罗J.
NLog有一个${newline}LayoutRenderer,它会在输出中添加换行符.
如果您希望"标题"仅在日志文件中出现一次(或每次运行一次),您可能也希望看到此问题:
这个答案还描述了向NLog日志文件添加标头: