Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Issue 659943006: Do not forget to call `defer glog.Flush()` in our applications (Closed)

Created:
6 years, 2 months ago by tfarina
Modified:
6 years, 2 months ago
Reviewers:
jcgregorio
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/buildbot@master
Visibility:
Public.

Description

Do not forget to call `defer glog.Flush()`in our applications. I did a little experiment to verify if this call was or not necessary. The experiment was: $ go get github.com/golang/glog Without Flush() call: $ cat example1.go package main import "flag" import "github.com/golang/glog" func main() { flag.Parse() glog.Infoln("Prepare to repel boarders") } $ mkdir log $ go run example1.go -log_dir=./log Then take a look at the log files under ./log dir. You won't see the message "Prepare to repel boarders" there. With Flush() call: $ cat example2.go package main import "flag" import "github.com/golang/glog" func main() { flag.Parse() defer glog.Flush() glog.Infoln("Prepare to repel boarders") } $ mkdir log2 $ go run example2.go -log_dir=./log2 Now look at the log files under ./log2 dir, you should see the "Prepare to repel boarders" message there. So in order to properly store the log messages of your server applications we need to add the call `defer glog.Flush()` to them. Also the documentation in https://godoc.org/github.com/golang/glog state that pretty clear with the following phrase: "Programs should call Flush before exiting to guarantee all log output is written." The above experiment/finding is also available and documented at https://github.com/tfarina/rsc/tree/master/go/golang_glog. BUG=None TEST=see above R=jcgregorio@google.com Committed: https://skia.googlesource.com/buildbot/+/a8a82069d68618942fdf7b7f8ce31f95ef7548ee

Patch Set 1 #

Patch Set 2 : cleanup golden/go/skiacorrectness/main.go comments #

Patch Set 3 : revert titletool changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -14 lines) Patch
M golden/go/skiacorrectness/main.go View 1 2 chunks +2 lines, -8 lines 0 comments Download
M monitoring/go/grains/grains.go View 2 chunks +2 lines, -2 lines 0 comments Download
M monitoring/go/prober/main.go View 2 chunks +2 lines, -4 lines 0 comments Download
M perf/go/ingest/main.go View 1 chunk +2 lines, -0 lines 0 comments Download
M perf/go/logserver/main.go View 1 chunk +1 line, -0 lines 0 comments Download
M perf/go/perf_migratedb/main.go View 1 chunk +1 line, -0 lines 0 comments Download
M perf/go/skiaperf/main.go View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
tfarina
6 years, 2 months ago (2014-10-17 21:40:00 UTC) #1
jcgregorio
On 2014/10/17 21:40:00, tfarina wrote: LGTM
6 years, 2 months ago (2014-10-18 00:11:25 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/659943006/40001
6 years, 2 months ago (2014-10-19 23:37:56 UTC) #4
commit-bot: I haz the power
6 years, 2 months ago (2014-10-19 23:38:09 UTC) #5
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as a8a82069d68618942fdf7b7f8ce31f95ef7548ee

Powered by Google App Engine
This is Rietveld 408576698