-
Notifications
You must be signed in to change notification settings - Fork 65
Closed
Description
The cdsapi.Client constructor includes a call to logging.basicConfig which modifies the logging behavior for loggers unrelated to cdsapi. Here's an example:
import logging
import cdsapi
# external logger initially at WARNING level:
my_logger = logging.getLogger('my_logger')
print(my_logger) # <Logger my_logger (WARNING)>
my_logger.info('this is not printed')
client = cdsapi.Client()
# external logger now set to INFO:
print(my_logger) # <Logger my_logger (INFO)>
my_logger.info('this is printed')output:
<Logger my_logger (WARNING)>
<Logger my_logger (INFO)>
2021-08-20 07:52:24,840 INFO this is printed
And in fact it modifies the log level of loggers from a bunch of other packages; check out the contents of logging.root.manager.loggerDict before and after creating a Client object and you'll see many of them switch from WARNING to INFO as well.
I have a patch ready to fix this and will submit a PR shortly.
AdamRJensen and pag
Metadata
Metadata
Assignees
Labels
No labels