From 1dc9f51c4705a2e66fb0a2d35ef541a1a0c0250c Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 13 Mar 2012 16:53:10 -0400 Subject: [PATCH] CC-3411: pypo-notify should write to its own log -done --- python_apps/pypo/logging.cfg | 16 ++++++++++++++-- python_apps/pypo/pypo-notify.py | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/python_apps/pypo/logging.cfg b/python_apps/pypo/logging.cfg index 6dae7d9c5..c74ad0b68 100644 --- a/python_apps/pypo/logging.cfg +++ b/python_apps/pypo/logging.cfg @@ -1,8 +1,8 @@ [loggers] -keys=root,fetch,push,recorder,message_h +keys=root,fetch,push,recorder,message_h,notify [handlers] -keys=pypo,recorder,message_h +keys=pypo,recorder,message_h,notify [formatters] keys=simpleFormatter @@ -35,6 +35,18 @@ handlers=message_h qualname=message_h propagate=0 +[logger_notify] +level=DEBUG +handlers=notify +qualname=notify +propagate=0 + +[handler_notify] +class=logging.handlers.RotatingFileHandler +level=DEBUG +formatter=simpleFormatter +args=("/var/log/airtime/pypo/notify.log", 'a', 1000000, 5,) + [handler_pypo] class=logging.handlers.RotatingFileHandler level=DEBUG diff --git a/python_apps/pypo/pypo-notify.py b/python_apps/pypo/pypo-notify.py index ef480691f..5139a4aad 100644 --- a/python_apps/pypo/pypo-notify.py +++ b/python_apps/pypo/pypo-notify.py @@ -72,7 +72,7 @@ class Notify: self.api_client = api_client.api_client_factory(config) def notify_media_start_playing(self, data, media_id): - logger = logging.getLogger() + logger = logging.getLogger("notify") logger.debug('#################################################') logger.debug('# Calling server to update about what\'s playing #') @@ -83,7 +83,7 @@ class Notify: # @pram time: time that LS started def notify_liquidsoap_status(self, msg, stream_id, time): - logger = logging.getLogger() + logger = logging.getLogger("notify") logger.debug('#################################################') logger.debug('# Calling server to update liquidsoap status #') @@ -100,7 +100,7 @@ if __name__ == '__main__': print '#########################################' # initialize - logger = logging.getLogger() + logger = logging.getLogger("notify") if options.error and options.stream_id: try: