Debug level is not propagated to service threads
Description
Logger output on predict and train functions with lower level than WARN is not printed on stderr.
Steps to Reproduce
- Download demo_app (or any other use case).
- Create a logger in the api module and log in get_meatada and predict using debug, for example:
import logging
logger = logging.getLogger(__name__)
def get_metadata():
logger.debug("Some debug information")
return {"status": "All ok, debug was printed"}
def get_predict_args():
return {}
def predict(**kwargs):
logger.debug("Some debug information")
return {"status": "Debug was not printed"}
- Create a configuration file which set debug level to "DEBUG" (.
/deepaas.conf):
[DEFAULT]
debug = true
log_date_format = %Y-%m-%d %H:%M:%S
- Run using the confg file:
deepaas-run --config-file deepaas.conf
Expected behavior:
When calling predict / train method, debug information should be printed.
(like in ´get_metadata`)
Actual behavior
Only logger print levels higher or equal than WARN are printed on predict / train method.
Versions
$ deepaas-run --version
2.1.0
Extra information
I see the functions predict and train are executed by workers. However, the logger level at those workers seems to not be inherited from the original logger level.
@IgnacioHeredia, I think this issue is related to what we spoke today. I was testing with @vykozlov and there might be a race condition somewhere:
- Starting with
--debugand no config, prints debug info at the beginning but not from methods. - Starting without
--debugbut config, does not print debug at the beginning but does for methods.
Also, when I created this issue, I was testing with the config and not with --debug, it might happen that aiohttp does not propagate logger to workers if arg --debug is not set? Not sure how much is worth value to investigate if a new version is comming with different web framework.