-
Notifications
You must be signed in to change notification settings - Fork 76
Description
Package affected: Serilog.Sinks.Console 6.0.0
Target framework: net8.0
OS: Windows 10
Serilog 4.0.0 came with a new built-in support for an UtcTimestamp
token in addition to the existing Timestamp
token for output templates. This feature was introduced via Serilog PR #2051.
The Serilog.Sinks.Console package in version 6.0.0 (although requiring Serilog 4.0.0+) doesn't seem to support this new built-in token yet. It would be great if support could be added to Serilog.Sinks.Console as well.
Repro steps:
An output template like the following (from the readme example):
.WriteTo.Console(
outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")
will output the log entry's timestamp in local time (ignoring the time zone offset).
Now change the output template to use the new Serilog built-in UtcTimestamp
token like this:
.WriteTo.Console(
outputTemplate: "[{UtcTimestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")
Actual behavior:
- The log entry timestamp is missing from the formatted output written to the console. This is because the UtcTimestamp token is unknown and no such property was enhanced.
Expected behavior:
- The console sink recognizes the UtcTimestamp as a built-in token and converts the event log's Timestamp to UTC and formats the UTC timestamp according to the (optional) format string.
Let me know if need more info is needed!
Best regards!