https://prefect.io logo
m

Moe

08/16/2023, 6:23 PM
Hi, is there a way to save prefect logs somewhere locally? I am using prefect's
get_run_logger
in my flows and adding in occassional
<http://logging.info|logging.info>('...')
on my own in my tasks as well as flows. And I can see all the flow run logs in the UI. But how can I save these logs for each flow run locally?
c

Christopher Boyd

08/16/2023, 6:26 PM
HI Moe, have you come across this discourse article? https://discourse.prefect.io/t/how-to-stream-prefect-logs-to-a-file/1963/5
🙌 1
m

Moe

08/17/2023, 1:18 AM
@Christopher Boyd Thank you so much.
@Christopher Boyd Curious to know about the last question in that thread.
Is it possible to separate the log for each flow run using this logging.yml method?
I went through and followed this article but I am not getting any local logs and the logs that typically prints out on the UI do not show up anymore.
At least creating this logging.yml file did something. But need some help on this. Please advise.
c

Christopher Boyd

08/21/2023, 12:21 PM
Hey Moe, you need to use the logging.yaml that matches the version that you are using if you want to override it, as there have been version differences between loggers. Updating the logging.yaml should just be adding two things: a file logging class updating what logs to where I wouldn’t remove anything existing
again, matching your logging.yaml from the source, to the version you are using - https://github.com/PrefectHQ/prefect/blob/6c7233bbe55fbe554956bbc70fbfa31de12c1543/src/prefect/logging/logging.yml#L4