Skip to content

Commit

Permalink
Avoid get_logger overriding root logger level (#17569)
Browse files Browse the repository at this point in the history
### Description
Instead, set level to DEBUG for the logger returned.



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

Otherwise, this function call overrides root logger level setting, which
affects logging facility of other python packages.
  • Loading branch information
BowenBao authored Sep 19, 2023
1 parent 730fab3 commit 152e61d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/python/util/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


def get_logger(name):
logging.basicConfig(format="%(asctime)s %(name)s [%(levelname)s] - %(message)s", level=logging.DEBUG)

return logging.getLogger(name)
logging.basicConfig(format="%(asctime)s %(name)s [%(levelname)s] - %(message)s")
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
return logger

0 comments on commit 152e61d

Please sign in to comment.