https://prefect.io logo
Title
p

Peter

06/23/2020, 12:01 AM
Also here's a toy script that illustrates my issue:
The log message "hello from standard_logger" is never logged by prefect
m

Marwan Sarieddine

06/23/2020, 12:03 AM
Hi @Peter you should be able to add your custom logger using the extra_loggers config https://docs.prefect.io/core/concepts/logging.html#extra-loggers
👍 1
c

Chris White

06/23/2020, 12:08 AM
Prefect shouldn’t affect other loggers at all; in your example code you need to set a handler + a log level and then the logs appear:
standard_logger = logging.getLogger(__name__)
standard_logger.setLevel(<http://logging.INFO|logging.INFO>)
standard_logger.addHandler(logging.StreamHandler())
(Marwan’s suggestion is also a good one - it tells Prefect to configure the loggers for you; this is particularly useful when running flows against Prefect’s API)
:upvote: 2
p

Peter

06/24/2020, 7:04 PM
Thanks for following up @Chris White! Btw, you're like everywhere haha - all over github issues and slack being super helpful - very impressed. We were about to try that method of configuring our existing loggers manually before @Marwan Sarieddine suggested the extra loggers option, which feels cleaner to us, so we're going with that method. We're not using prefect server in prod yet but it's good to know this is the best practice. Thanks again 😄
c

Chris White

06/24/2020, 7:04 PM
anytime!