Hi, I'm trying to get application logs to Prefect ...
# ask-community
j
Hi, I'm trying to get application logs to Prefect UI, but the application logs are printed only to the agent container stdout. I have tried:
PREFECT_LOGGING_EXTRA_LOGGERS: mylogger
on agent and on orion server, and various combinations of setting the handler for my logger in the flow. I have self-hosted Prefect 2.7.8. Any ideas what should I check in the configuration?
t
I wonder if this is the same issue I raised on the github issue tracker: https://github.com/PrefectHQ/prefect/issues/7755#issuecomment-1338581831
The logs from an external were being captured and streamed to t he Orion server in version prior to 2.7.8. After that the output was printed to the console handler, but not the orion one. I ended up tracking down a one liner change in
prefect.logging.configuration.py
that made things work.
a
j
Thanks! I will dig through the links. I did quick workaround by adding orionhandler to my application logger
Copy code
logger = get_run_logger()
    for h in logger.logger.handlers:
        root.addHandler(h)
t
Would you mind trying out my little work around that I outline in the github issue? I am super curious if you are seeing the same problem -- I had trouble creating the minimum working example, and it has been eating my soul since
🆗 1