use the correct logger for the callback receiver

the callback receiver and dispatcher share several modules, so add logic
to use the correct logger
This commit is contained in:
Ryan Petrello
2019-03-15 08:08:32 -04:00
parent c6ae7d84a2
commit 32ee9838af
2 changed files with 11 additions and 3 deletions

View File

@@ -4,6 +4,7 @@
import os
import logging
import signal
import sys
from uuid import UUID
from queue import Empty as QueueEmpty
@@ -13,7 +14,10 @@ from kombu.mixins import ConsumerMixin
from awx.main.dispatch.pool import WorkerPool
logger = logging.getLogger('awx.main.dispatch')
if 'run_callback_receiver' in sys.argv:
logger = logging.getLogger('awx.main.commands.run_callback_receiver')
else:
logger = logging.getLogger('awx.main.dispatch')
def signame(sig):
@@ -108,7 +112,7 @@ class AWXConsumer(ConsumerMixin):
def stop(self, signum, frame):
self.should_stop = True # this makes the kombu mixin stop consuming
logger.debug('received {}, stopping'.format(signame(signum)))
logger.warn('received {}, stopping'.format(signame(signum)))
self.worker.on_stop()
raise SystemExit()