Also here's a toy script that illustrates my issue...
# prefect-community
p
Also here's a toy script that illustrates my issue:
The log message "hello from standard_logger" is never logged by prefect
m
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
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:
Copy code
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
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
anytime!