I just tried a very minimal flow and logs aren't b...
# ask-community
j
I just tried a very minimal flow and logs aren't being captured:
Copy code
import logging

from prefect import flow
from prefect.logging import get_run_logger

logger = logging.getLogger(__name__)


@flow
def main_basic():
    # logger = get_run_logger()
    logger.info("This is an info message")
    logger.warning("This is a warning")
    logger.error("This is an error")


if __name__ == "__main__":
    main_basic()
(continues in đź§µ) edit: mostly solved âś…
âś… 1
I can use
get_run_logger
, but that only works for the flow function. if I have some custom code that is being called, then log output is not being captured
I also read about
PREFECT_LOGGING_EXTRA_LOGGERS
, but it seems a bit tedious to specify it for every single library I have
is there a way to capture all logging output?
(tried #C04DZJC94DC already, didn't work)
after digging a bit more into how this works under the hood, I get that it might be difficult to instrument all the loggers without monkeypatching. solved this by using said
PREFECT_LOGGING_EXTRA_LOGGERS
for now 🙂