SEBA-555 create_logger inside init() method
Change-Id: Ie029ed25f2199a1a288aff963fd8f22c50009c98
diff --git a/lib/xos-kafka/xoskafka/xoskafkaproducer.py b/lib/xos-kafka/xoskafka/xoskafkaproducer.py
index 241d87f..2c61239 100644
--- a/lib/xos-kafka/xoskafka/xoskafkaproducer.py
+++ b/lib/xos-kafka/xoskafka/xoskafkaproducer.py
@@ -19,8 +19,7 @@
from xosconfig import Config
from multistructlog import create_logger
-log = create_logger(Config().get("logging"))
-
+log = None
kafka_producer = None
@@ -32,8 +31,12 @@
@staticmethod
def init():
+ global log
global kafka_producer
+ if not log:
+ log = create_logger(Config().get("logging"))
+
if kafka_producer:
raise Exception("XOSKafkaProducer already initialized")