p

    Peter

    2 years ago
    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

    2 years ago
    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
    Chris White

    Chris White

    2 years ago
    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)
    p

    Peter

    2 years ago
    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 😄
    Chris White

    Chris White

    2 years ago
    anytime!