Serilog - 可以在RollingFile接收器中更改DateTime/Timestamp格式

Aar*_*ver 2 serilog rollingfilesink

RollingFile接收器的当前输出日期时间如下

2015-04-06 18:40:54.400 +10:00 [Information] Hello World!
Run Code Online (Sandbox Code Playgroud)

无论如何要删除TimeZone偏移量?+10:00.实现以下输出;

2015-04-06 18:40:54.400 [Information] Hello World!
Run Code Online (Sandbox Code Playgroud)

在我的情况下,时区偏移是多余的绒毛,这只是混乱我的文本日志.

Nic*_*rdt 7

您可以outputTemplate.RollingFile()配置方法指定参数:

.WriteTo.RollingFile(
    outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level}] {Message}{NewLine}{Exception}")
Run Code Online (Sandbox Code Playgroud)