Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: time zone in log prefix #9483

Closed
rhysh opened this issue Dec 31, 2014 · 1 comment
Closed

log: time zone in log prefix #9483

rhysh opened this issue Dec 31, 2014 · 1 comment
Milestone

Comments

@rhysh
Copy link
Contributor

rhysh commented Dec 31, 2014

Package log can print out timestamps with the Ldate/Ltime/Lmicroseconds flags, but the time displayed is in local time without a time zone (http://play.golang.org/p/848Wa50X0d). The machines on which I run software don't always agree on the timezone (PST/PDT for laptop, UTC for server), which makes this output sometimes confusing.

Is there a way for the log lines to be unambiguous? Maybe

  • Set the "Local" timezone of the entire process to "UTC"
  • Add a flag to package log to force its timezone to "UTC"
  • Add a flag to package log to print the timezone as part of the prefix

I'd like to see the third option, but I'm open to solutions that don't require changes to the stdlib. Thanks!

@robpike robpike self-assigned this Jan 6, 2015
@nightlyone
Copy link
Contributor

I would add two flags: One adding the numeric timezone AND one to log time in UTC.

UTC logging is very useful on its own to easily consolidate server logs across continents.

@bradfitz bradfitz added this to the Go1.5Maybe milestone Apr 1, 2015
@mikioh mikioh modified the milestones: Go1.5, Go1.5Maybe Apr 12, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
@rsc rsc unassigned robpike Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants