Eric Raymond (esr) says we should always use UTC instead of local
time in our log messages. Specifically, he says we should use RFC3339
timestamps. Using local timestamps and other ambiguous information in
log entries is a well established practice in the Unix world so esr is
not just complaining about “kids today” when he urges us to use
RFC3339 timestamps.
The problem with local times is obvious when you think about it. With
today’s interconnected world, we’re dealing with events from all over
the world and local times make it hard to compare them. The advantage
of an RFC3339 timestamp is that it is easily distinguishable from
other formats and can be (lexicographically) compared with others of
its kind to determine the temporal order of the timestamps.
An important example of an application where this matters is
distributed version control systems. Commits can potentially come from
anywhere is the world and local times make it difficult to sort the
commits for logging and other purposes. Oddly, Git gets this wrong—or
at least not completely right. While it does store the times in UTC it
displays them in the committer’s local time. That leads to exactly the
type of problems you would expect.
This is, in principal, an easy problem to solve but, of course,
practical considerations will ensure that it probably won’t be anytime
soon. Take a look at esr’s post for more details and for some notes on
how this problem long predates the computer age.