Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit 4f1b71e

Browse files
author
James.E.Bell
committed
Fixed logger initialization
Erroneously wrapped the `_logger` setting in the new if block. Signed-off-by: James.E.Bell <james.e.bell@target.com>
1 parent a159074 commit 4f1b71e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tgt_grease/core/Logging.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -286,18 +286,18 @@ def DefaultLogger(self):
286286
287287
"""
288288
global GREASE_LOG_HANDLER
289+
self._logger = logging.getLogger('GREASE')
290+
self._logger.setLevel(logging.DEBUG)
291+
self._formatter = logging.Formatter(
292+
"{"
293+
"\"timestamp\": \"%(asctime)s.%(msecs)03d\", "
294+
"\"thread\": \"%(threadName)s\", "
295+
"\"level\" : \"%(levelname)s\", "
296+
"\"message\" : \"%(message)s\"}",
297+
"%Y-%m-%d %H:%M:%S"
298+
)
299+
self._formatter.converter = time.gmtime
289300
if not GREASE_LOG_HANDLER:
290-
self._logger = logging.getLogger('GREASE')
291-
self._logger.setLevel(logging.DEBUG)
292-
self._formatter = logging.Formatter(
293-
"{"
294-
"\"timestamp\": \"%(asctime)s.%(msecs)03d\", "
295-
"\"thread\": \"%(threadName)s\", "
296-
"\"level\" : \"%(levelname)s\", "
297-
"\"message\" : \"%(message)s\"}",
298-
"%Y-%m-%d %H:%M:%S"
299-
)
300-
self._formatter.converter = time.gmtime
301301
if os.path.isdir(self._conf.greaseDir):
302302
GREASE_LOG_HANDLER = logging.FileHandler(self._conf.get('Logging', 'file'))
303303
GREASE_LOG_HANDLER.setLevel(logging.DEBUG)

0 commit comments

Comments
 (0)