TwP / logging

A flexible logging library for use in Ruby programs based on the design of Java's log4j library.
https://rubygems.org/gems/logging
MIT License
530 stars 101 forks source link

Support UTC time formats #156

Closed TwP closed 7 years ago

TwP commented 7 years ago

@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.