Revision fdfd8c6d snf-cyclades-app/synnefo/logic/dispatcher.py

b/snf-cyclades-app/synnefo/logic/dispatcher.py
65 65
from synnefo.logic import queues
66 66

  
67 67
import logging
68
log = logging.getLogger()
68

  
69
log = logging.getLogger("dispatcher")
70
log_amqp = logging.getLogger("amqp")
71
log_logic = logging.getLogger("synnefo.logic")
72

  
73
LOGGERS = [log, log_amqp, log_logic]
69 74

  
70 75

  
71 76
class Dispatcher:
......
273 278
    import logging
274 279
    formatter = logging.Formatter("%(asctime)s %(name)s %(module)s [%(levelname)s] %(message)s")
275 280
    if opts.debug:
276
        stream_handler = logging.StreamHandler()
277
        stream_handler.setFormatter(formatter)
278
        log.addHandler(stream_handler)
281
        log_handler = logging.StreamHandler()
282
        log_handler.setFormatter(formatter)
279 283
    else:
280 284
        import logging.handlers
281 285
        log_file = "/var/log/synnefo/dispatcher.log"
282
        file_handler = logging.handlers.WatchedFileHandler(log_file)
283
        file_handler.setFormatter(formatter)
284
        log.addHandler(file_handler)
286
        log_handler = logging.handlers.WatchedFileHandler(log_file)
287
        log_handler.setFormatter(formatter)
285 288

  
286
    log.setLevel(logging.DEBUG)
289
    for l in LOGGERS:
290
        l.addHandler(log_handler)
291
        l.setLevel(logging.DEBUG)
287 292

  
288 293

  
289 294
def main():

Also available in: Unified diff