summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-08-23 20:30:57 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-08-23 20:30:57 +0000
commit2a6de07dddb40e1799322879a047a4b42490d16b (patch)
treecea8cf4cba4e86c36a9f30db19c209899bbd9207 /src
parent511bd3ddb35659e48081c78962efa4e1050b2c65 (diff)
downloadbcfg2-2a6de07dddb40e1799322879a047a4b42490d16b.tar.gz
bcfg2-2a6de07dddb40e1799322879a047a4b42490d16b.tar.bz2
bcfg2-2a6de07dddb40e1799322879a047a4b42490d16b.zip
Fall back to localhost:514 for syslog (needed for nexenta)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2097 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Logging.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/Logging.py b/src/lib/Logging.py
index b91fdd035..0b59e8d25 100644
--- a/src/lib/Logging.py
+++ b/src/lib/Logging.py
@@ -86,6 +86,7 @@ class FragmentingSysLogHandler(logging.handlers.SysLogHandler):
def __init__(self, procname, path, facility):
self.procname = procname
+ self.unixsocket = False
logging.handlers.SysLogHandler.__init__(self, path, facility)
def emit(self, record):
@@ -134,7 +135,10 @@ def setup_logging(procname, to_console=True, to_syslog=True, syslog_facility='lo
logging.root.addHandler(console)
if to_syslog:
try:
- syslog = FragmentingSysLogHandler(procname, '/dev/log', syslog_facility)
+ try:
+ syslog = FragmentingSysLogHandler(procname, '/dev/log', syslog_facility)
+ except socket.error:
+ syslog = FragmentingSysLogHandler(procname, ('localhost', 514), syslog_facility)
syslog.setLevel(logging.DEBUG)
syslog.setFormatter(logging.Formatter('%(name)s[%(process)d]: %(message)s'))
logging.root.addHandler(syslog)