<@ULVA73B9P> I want prefect to catch my logs that ...
# ask-marvin
t
@Marvin I want prefect to catch my logs that I define using this logger
logger = logging.getLogger(__name__)
I know I could define extra loggers using
PREFECT_LOGGING_EXTRA_LOGGERS
but I don’t want to be changing this env variable manually for each logger that I want, is there anyway to make prefect 2 catch all such loggers
m
I found a relevant discussion on the Prefect Discourse forum that might help you. Although it doesn't directly address capturing logs from all loggers without manually updating the
PREFECT_LOGGING_EXTRA_LOGGERS
environment variable, it does provide some insights on how to configure logging in Prefect. You can find the discussion here: How to stream prefect logs to a file. However, I couldn't find a direct solution to your problem. I recommend posting your question on the Prefect Discourse forum to get help from the Prefect community. They might have more experience with this specific use case and can provide you with a suitable solution.
z
Python loggers inherit from each other so if you set
foo
as an extra logger then have all of your loggers be
foo.bar
or
foo.bar.baz
or
foo.apple
they’ll all be sent to
foo
/ Prefect
🙌 1