summaryrefslogtreecommitdiff
path: root/oslo_rootwrap/wrapper.py
diff options
context:
space:
mode:
Diffstat (limited to 'oslo_rootwrap/wrapper.py')
-rw-r--r--oslo_rootwrap/wrapper.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/oslo_rootwrap/wrapper.py b/oslo_rootwrap/wrapper.py
index dd223fa..3b63866 100644
--- a/oslo_rootwrap/wrapper.py
+++ b/oslo_rootwrap/wrapper.py
@@ -99,10 +99,17 @@ class RootwrapConfig(object):
def setup_syslog(execname, facility, level):
+ try:
+ handler = logging.handlers.SysLogHandler(address='/dev/log',
+ facility=facility)
+ except IOError:
+ logging.warning("Unable to setup syslog, maybe /dev/log socket needs "
+ "to be restarted. Ignoring syslog configuration "
+ "options.")
+ return
+
rootwrap_logger = logging.getLogger()
rootwrap_logger.setLevel(level)
- handler = logging.handlers.SysLogHandler(address='/dev/log',
- facility=facility)
handler.setFormatter(logging.Formatter(
os.path.basename(execname) + ': %(message)s'))
rootwrap_logger.addHandler(handler)