Thread
#prefect-community
    Nelson Griffiths

    Nelson Griffiths

    1 year ago
    I have a quick question about logging that I can't quite find in the docs. I have a private package that I pip install into my docker environment that runs my Prefect flows. I want to see the logging output from the code run inside that private package on the UI for prefect cloud. It currently shows up on the agent side, but I can't seem to figure out how to get it to log to the UI. Since it is in another package that is used other places it doesn't make sense to use the Prefect logger like I do for code running in the flows. I am using loguru and just writing to stdout. Any easy way to make these logs appear in the UI?
    Chris White

    Chris White

    1 year ago
    Hey Nelson, ultimately you need to add the Prefect Cloud logging handler to your logger: https://github.com/PrefectHQ/prefect/blob/master/src/prefect/utilities/logging.py#L137 A few notes on this: • make sure that the logger is being used in an environment submitted by an Agent, so that it has the appropriate configuration through environment variables • if your logger has a simple static name, you can also update Prefect configuration to automatically configure it: https://github.com/PrefectHQ/prefect/blob/master/src/prefect/config.toml#L110 (you can set this via the
    PREFECT__LOGGING__EXTRA_LOGGERS
    environment variable on your agent with the
    -e
    CLI flag)
    Kevin Kho

    Kevin Kho

    1 year ago
    Docs for this here