@andrewtran634 asked a great question a while back:
Quick question, is there a way to format so that date is in UTC instead of local time?
Alas, currently there is not a way to format the date in UTC instead of the local time. The time for a logging event is set when the event is created, and that also determines the timezone that will be used when the time is formatted by the layouts.
I think the way to enable this feature is to provide a global utc_offset for the Logging library. This will default to the local time zone mirroring the current functionality. But you can set this to be "+00:00" for UTC. Layouts can override this global utc_offset so that one appender could output in the local time zone, while another appender can output in UTC.
@andrewtran634 asked a great question a while back:
Alas, currently there is not a way to format the date in UTC instead of the local time. The time for a logging event is set when the event is created, and that also determines the timezone that will be used when the time is formatted by the layouts.
I think the way to enable this feature is to provide a global
utc_offset
for the Logging library. This will default to the local time zone mirroring the current functionality. But you can set this to be "+00:00" for UTC. Layouts can override this globalutc_offset
so that one appender could output in the local time zone, while another appender can output in UTC.