glog flush interval

1,202 views
Skip to first unread message

Tim Hockin

unread,
Jun 24, 2014, 8:06:13 PM6/24/14
to golan...@googlegroups.com
Hey all,

I am finally learning go. I was happy to find familiar glog, but I
find the flushing behavior unsettling - 30 seconds is a very long
time. Is there any way to change that - a flag I am not seeing or
something? Or to make error logs flush automatically? Or something?

Would the owners of this lib be amenable to any of the above?

Tim

Ian Lance Taylor

unread,
Jun 24, 2014, 9:00:12 PM6/24/14
to Tim Hockin, golang-nuts
It seems straightforward to flush as often as you like:

go func() {
for _ = range time.Tick(interval) {
glog.Flush()
}
}()

Unless glog.Flush is very slow, or unless a lot of people have a need
for different flush intervals, I'm not sure it's worth complicating
the glog package.

I don't know if there is a way to flush automatically.

Ian

Tim Hockin

unread,
Jun 24, 2014, 10:05:39 PM6/24/14
to Ian Lance Taylor, golang-nuts

The glog lib already has a 30 second goroutine.  I am just saying that is a very long time, and why can't I tune that?  Or why does it not do as the C++ form does - flush on error logs?

We do already run our own go routine, but it feels sort of lame that we have to wrap a library like that.

Rob Pike

unread,
Jun 24, 2014, 11:28:16 PM6/24/14
to Tim Hockin, Ian Lance Taylor, golang-nuts
The package is pushed from google. I'd like to keep it that way to
avoid maintaining two diverging versions. Given that buffering and
flushing logs is already a source of some problems, I'd like to avoid
complicating things further. Once, if, we've figured out the right
overall solution internally, I'll be happy to push it to the public
repo.

-rob
Reply all
Reply to author
Forward
0 new messages