在RollingFile.outputTemplate
我使用我在水槽<appSettings>
配置如下:
<add key="serilog:write-to:RollingFile.outputTemplate" value="{Timestamp:HH:mm:ss} [{Level}] {Message}{NewLine}{Exception}" />
Run Code Online (Sandbox Code Playgroud)
我得到的输出日志为:
19:55:10 [Information] Application_Start...
但是,我还要输出生成日志的类名(源),如 -
19:55:10 [Information] [Global.asax.cs] Application_Start...
我应该添加什么"价值"?我添加了[Source]但是没有用.
value ="{Timestamp:HH:mm:ss} [{Level}] [Source?] {Message} {NewLine} {Exception}"
Nic*_*rdt 22
属性名称被调用SourceContext
- 所以:
value="{Timestamp:HH:mm:ss} [{Level}] [{SourceContext}] {Message}{NewLine}{Exception}"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5784 次 |
最近记录: |