Commit f79359f8 by Szeberényi Imre

Migration to IK

parent da8159bb
...@@ -7,8 +7,11 @@ from os import getenv ...@@ -7,8 +7,11 @@ from os import getenv
from socket import gethostname from socket import gethostname
from threading import Event from threading import Event
import logging import logging
from celery.utils.log import get_task_logger
from celery.signals import after_setup_task_logger
from celery.app.log import TaskFormatter
logger = logging.getLogger() logger = get_task_logger(__name__)
HOSTNAME = gethostname().split('.')[0] HOSTNAME = gethostname().split('.')[0]
AMQP_URI = getenv('AMQP_URI') AMQP_URI = getenv('AMQP_URI')
......
...@@ -6,11 +6,27 @@ from protocol import inotify_handler ...@@ -6,11 +6,27 @@ from protocol import inotify_handler
from os import getenv, listdir, path, environ, kill, getpid from os import getenv, listdir, path, environ, kill, getpid
import signal import signal
import logging import logging
from celery.utils.log import get_task_logger
logging.basicConfig() from celery.signals import after_setup_task_logger
logger = logging.getLogger() from celery.app.log import TaskFormatter
import sys
from multiprocessing import current_process
process = current_process()
process.name = sys.argv[0]
logger = get_task_logger(__name__)
level = environ.get('LOGLEVEL', 'INFO') level = environ.get('LOGLEVEL', 'INFO')
logger.setLevel(level) logger.setLevel(level)
#logger = logging.getLogger(__name__)
@after_setup_task_logger.connect
def setup_task_logger(logger, *args, **kwargs):
for handler in logger.handlers:
handler.setFormatter(TaskFormatter('%(asctime)s - %(levelname)s/agentdriver.%(processName)s - %(module)s - %(message)s'))
SOCKET_DIR = getenv('SOCKET_DIR', '/var/lib/libvirt/serial') SOCKET_DIR = getenv('SOCKET_DIR', '/var/lib/libvirt/serial')
...@@ -26,6 +42,7 @@ Worker.install_platform_tweaks = install_platform_tweaks ...@@ -26,6 +42,7 @@ Worker.install_platform_tweaks = install_platform_tweaks
def reactor_started(): def reactor_started():
# print(vars(logger.handlers[0].formatter))
logger.info("reactor_started") logger.info("reactor_started")
reactor.running_tasks = {} reactor.running_tasks = {}
reactor.ended_tasks = {} reactor.ended_tasks = {}
......
...@@ -7,12 +7,11 @@ import time ...@@ -7,12 +7,11 @@ import time
import struct import struct
from os import getenv from os import getenv
import gc import gc
from utils import SerialLineReceiverBase from utils import SerialLineReceiverBase
from agentcelery import agent_started, agent_stopped, renew from agentcelery import agent_started, agent_stopped, renew
from celery.utils.log import get_task_logger
logger = logging.getLogger() logger = get_task_logger(__name__)
reactor.connections = {} reactor.connections = {}
......
...@@ -8,7 +8,7 @@ try: ...@@ -8,7 +8,7 @@ try:
except NameError: except NameError:
unicode = str unicode = str
logger = logging.getLogger() logger = logging.getLogger(__name__)
class SerialLineReceiverBase(LineReceiver, object): class SerialLineReceiverBase(LineReceiver, object):
delimiter = b'\r' delimiter = b'\r'
......
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 sign in to comment