在NLog布局中包含回车换行

Pau*_*son 4 vb.net nlog

是否可以在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.

wag*_*ghe 9

NLog有一个${newline}LayoutRenderer,它会在输出中添加换行符.

如果您希望"标题"仅在日志文件中出现一次(或每次运行一次),您可能也希望看到此问题:

Nlog - 为日志文件生成标题部分

这个答案还描述了向NLog日志文件添加标头:

/sf/answers/298161321/