Skip to content

Commit 8fa8f23

Browse files
author
Bob Bui
committed
Fix condition for checking root logger handlers #53
1 parent 81e9957 commit 8fa8f23

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55
The format is based on [Keep a Changelog](http://keepachangelog.com/).
66

7+
## 1.2.6 - 2020-08-05
8+
- Fix condition for checking root logger handlers #53
9+
710
## 1.2.5 - 2020-08-04
811
- fix #44
912

json_logging/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
_request_util = None
3232
_default_formatter = None
3333

34+
3435
def get_correlation_id(request=None):
3536
"""
3637
Get current request correlation-id. If one is not present, a new one might be generated
@@ -79,16 +80,17 @@ def config_root_logger():
7980
& remove duplicate handlers for request instrumentation logging.
8081
Please made sure that you call this after you called "logging.basicConfig() or logging.getLogger('root')
8182
"""
82-
global _default_formatter
8383

8484
if not logging.root.handlers:
8585
_logger.error(
8686
"No logging handlers found for root logger. Please made sure that you call this after you called "
8787
"logging.basicConfig() or logging.getLogger('root')")
88+
return
8889

8990
if ENABLE_JSON_LOGGING:
9091
ENABLE_JSON_LOGGING_DEBUG and _logger.debug("Update root logger to using JSONLogFormatter")
9192

93+
global _default_formatter
9294
util.update_formatter_for_loggers([logging.root], _default_formatter)
9395

9496

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name="json-logging",
15-
version='1.2.5',
15+
version='1.2.6',
1616
packages=find_packages(exclude=['contrib', 'docs', 'tests*', 'example', 'dist', 'build']),
1717
license='Apache License 2.0',
1818
description="JSON Python Logging",

0 commit comments

Comments
 (0)