I would like to be able to respond (possibly simply by dying) to the glog being unable to log to disk due to a full disk. Is there any way to convince glog to report this condition to the program using it?
Asked
Active
Viewed 195 times
1
-
You can try installing your failure signal handler to see if it can catch it. See [here](https://google-glog.googlecode.com/svn/trunk/doc/glog.html) – simon Aug 13 '15 at 22:02
-
@simon Is there a signal handler for full disk? All I see in that link is the "Failure Signal Handler" which, since glog doesn't seem to think of full disk as an error, I'm not thinking would fire. – Patrick Aug 13 '15 at 22:09
-
Have you try it? What is the symptom you observed when glog being unable to log to disk due to a disk full? – simon Aug 13 '15 at 22:17
-
I haven't experienced a full disk with the signal handle registered, but the typical response by glog appears to be to hold the logs for writing once disk space becomes available. – Patrick Aug 13 '15 at 22:24
-
If you don't like that behavior, you can use the `google::SetStopLoggingIfFullDisk(const bool a_bValue)` to change the disk full behavior. – simon Aug 13 '15 at 22:49
-
@simon I believe the flag you suggested actually causes the above behavior. You may simply lose messages without the flag set. – Patrick Aug 14 '15 at 16:28
-
Yes, it is two side of the flag value, you can either turn it on or off. I think the default is on. If you turn it off, you might be able to catch the disk full in Failure signal handler. – simon Aug 18 '15 at 07:43
-
@simon regardless of how the flag is set, google glog does not either throw an exception or provide any data through the failure signal handler. – Patrick Aug 19 '15 at 20:57