Hello community, I've got a quick question - what ...
# prefect-community
Hello community, I've got a quick question - what would be the best way to add a custom log handler to existing Orion or Prefect logs (I am on Prefect 2.0b3)?
I asked something similar the other day - maybe this blog post could help? https://www.prefect.io/blog/logs-the-prefect-way/
upvote 1
Could you explain your use case? Do you want to attach a custom logger? if so, you could do that by adding an extra logger
Copy code
prefect config set PREFECT_LOGGING_EXTRA_LOGGERS=scipy
You may also adjust the log level used by specific Orion log handlers. E.g., you could set
to have only
logs reported to Orion. The console handlers will still default to level
My usual configuration is to use a 3rd part logger like loguru, use it's sink to dump python native log handler's logs and attach a custom handler to redirect these logs into an external API. If I need to do a similar setup for Prefect Orion's logs - I was hoping I would be able to either attach the handler or dump the logs into Loguru's sink. Any suggestions?
Good question - loguru is super specific - you would need to add Prefect’s log handlers as loguru
. This Discourse topic is for 1.0, but maybe it gives you some ideas on how to approach it in 2.0
Thanks @Anna Geller, this is helpful. let me give it a shot.
đź‘Ť 1