Do not crash if we can't access the logfile

* Check if we can access the logging directory. If not, print an error
message and exit.
parent 7a50ccd9
......@@ -1130,7 +1130,11 @@ if __name__ == "__main__":
if opts.daemonize:
logfile = os.path.join(config["general"]["logdir"], LOG_FILENAME)
handler = logging.handlers.WatchedFileHandler(logfile)
try:
handler = logging.handlers.WatchedFileHandler(logfile)
except IOError:
sys.stderr.write(" - Failed to open logging directory, exiting.\n")
sys.exit(1)
else:
handler = logging.StreamHandler()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment