Fix error when running synapse with no logfile

Fixes 'UnboundLocalError: local variable 'sighup' referenced before assignment'
This commit is contained in:
Richard van der Hoff 2017-10-26 16:45:20 +01:00
parent 1ad1ba9e6a
commit f7f90e0c8d
1 changed files with 5 additions and 1 deletions

View File

@ -148,8 +148,8 @@ def setup_logging(config, use_worker_options=False):
"%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s" "%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s"
" - %(message)s" " - %(message)s"
) )
if log_config is None:
if log_config is None:
level = logging.INFO level = logging.INFO
level_for_storage = logging.INFO level_for_storage = logging.INFO
if config.verbosity: if config.verbosity:
@ -176,6 +176,10 @@ def setup_logging(config, use_worker_options=False):
logger.info("Opened new log file due to SIGHUP") logger.info("Opened new log file due to SIGHUP")
else: else:
handler = logging.StreamHandler() handler = logging.StreamHandler()
def sighup(signum, stack):
pass
handler.setFormatter(formatter) handler.setFormatter(formatter)
handler.addFilter(LoggingContextFilter(request="")) handler.addFilter(LoggingContextFilter(request=""))