Commit 1ccb6901 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Fix dispatcher logging

parent c581d386
......@@ -52,7 +52,7 @@ from functools import wraps
from ordereddict import OrderedDict
from synnefo import settings
logger = logging.getLogger()
logger = logging.getLogger("amqp")
def reconnect_decorator(func):
......
......@@ -39,7 +39,7 @@ from synnefo.logic import utils, backend
from synnefo.lib.utils import merge_time
log = logging.getLogger()
log = logging.getLogger(__name__)
def handle_message_delivery(func):
""" Generic decorator for handling messages.
......
......@@ -65,7 +65,12 @@ from synnefo.logic import callbacks
from synnefo.logic import queues
import logging
log = logging.getLogger()
log = logging.getLogger("dispatcher")
log_amqp = logging.getLogger("amqp")
log_logic = logging.getLogger("synnefo.logic")
LOGGERS = [log, log_amqp, log_logic]
class Dispatcher:
......@@ -273,17 +278,17 @@ def setup_logging(opts):
import logging
formatter = logging.Formatter("%(asctime)s %(name)s %(module)s [%(levelname)s] %(message)s")
if opts.debug:
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(formatter)
log.addHandler(stream_handler)
log_handler = logging.StreamHandler()
log_handler.setFormatter(formatter)
else:
import logging.handlers
log_file = "/var/log/synnefo/dispatcher.log"
file_handler = logging.handlers.WatchedFileHandler(log_file)
file_handler.setFormatter(formatter)
log.addHandler(file_handler)
log_handler = logging.handlers.WatchedFileHandler(log_file)
log_handler.setFormatter(formatter)
log.setLevel(logging.DEBUG)
for l in LOGGERS:
l.addHandler(log_handler)
l.setLevel(logging.DEBUG)
def main():
......
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