Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Improving log.py to work when syslog is down #418

Merged
merged 1 commit into from May 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion kytos/core/logs.py
Expand Up @@ -21,7 +21,16 @@ def load_logging_file(cls, logging_file):
"""
cls.configuration = RawConfigParser()
cls.configuration.read(logging_file)
config.fileConfig(logging_file)

try:
config.fileConfig(logging_file)
except FileNotFoundError:
cls.configuration.set('handler_syslog', 'args', '[]')
config.fileConfig(cls.configuration)

log = getLogger(__name__)
msg = 'Syslog file not found, running Kytos without syslog.'
log.warning(msg)

@classmethod
def add_stream_handler(cls, stream):
Expand Down