1

We're using Serilog in our ASP.Net application and I've noticed, that it emits time in logs in UTC instead of local timezone. Server's timezone and time is set correctly (it equals to local time).

Is there a way to confiure Serilog to emit date and time in local timezone?

C:\Logs>type log-20190716_004.json

(...)

{"@t":"2019-07-16T10:30:00.0967307Z","@mt":"(...)","@l":"Warning","@x":"(...)"}

C:\Logs>time
The current time is: 12:31:43.95
C:\Logs>date
The current date is: Tue 07/16/2019
Spook
  • 25,318
  • 18
  • 90
  • 167
  • TL;DR is that serilog captures a DateTimeOffset, and it gets populated in a specific way. To render differently, the choices are either to do custom formatting at render time or to have an enricher capture and/or map differently and emit that. (Very happy to reopen if this is truly a separate issue - your question is clearly expressed and valid) – Ruben Bartelink Jul 16 '19 at 14:24

0 Answers0