Commit 865b57a0 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(configd) ignore syslog on startup when not excepting connections, closes...

(configd) ignore syslog on startup when not excepting connections, closes https://github.com/opnsense/core/issues/853

(cherry picked from commit 77336123)
parent 8a6ce661
......@@ -39,6 +39,7 @@ import sys
import logging
import signal
import time
import socket
import subprocess
import modules.processhandler
import modules.csconfigparser
......@@ -144,14 +145,17 @@ else:
# run as daemon, wrap the actual work process to enable automatic restart on sudden death
syslog_socket = "/var/run/log"
if os.path.exists(syslog_socket):
# bind log handle to syslog to catch messages from Daemonize()
# (if syslog facility is active)
loghandle = logging.getLogger("configd.py")
loghandle.setLevel(logging.INFO)
handler = logging.handlers.SysLogHandler(address=syslog_socket,
facility=logging.handlers.SysLogHandler.LOG_DAEMON)
handler.setFormatter(logging.Formatter("%(name)s %(message)s"))
loghandle.addHandler(handler)
try:
# bind log handle to syslog to catch messages from Daemonize()
# (if syslog facility is active)
loghandle = logging.getLogger("configd.py")
loghandle.setLevel(logging.INFO)
handler = logging.handlers.SysLogHandler(address=syslog_socket,
facility=logging.handlers.SysLogHandler.LOG_DAEMON)
handler.setFormatter(logging.Formatter("%(name)s %(message)s"))
loghandle.addHandler(handler)
except socket.error:
loghandle = None
else:
loghandle = None
# daemonize process
......
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