https://prefect.io logo
Title
a

Andrew P

05/12/2023, 3:29 PM
I assume this has been mentioned before, but is there a way to get prefect's logging to play nice with python's
logging
library (or stdout/stderr)? We don't want the prefect dependency and get-flow-logger calls in all of our business logic code, but it'd be nice to see debug and error code in the prefect cloud console
apologies if this is a repeat, a cursory search didn't yield much
a

alex

05/12/2023, 3:37 PM
You can set the
PREFECT_LOGGING_EXTRA_LOGGERS
env var to your loggers names and they will show up in the UI
a

Andrew P

05/12/2023, 3:44 PM
👍
Is that a comma-delineated list of logger names?
And is there a glob/star/catchall supported in case we want to see everything
Also, is there an in-code way to configure this? We might want to dynamically do it within/before a flow or task like:
loggers_to_pass_through = [name for name in logging.root.manager.loggerDict.keys() if name.startswith("some-biz-app-key")]


prefect.set_run_extra_loggers(loggers_to_pass_through)