Replies: 1 comment
-
If I simply try to create LogTail and put it to "handlers" or "root : handlers" args of LoggingConfig class, I'm getting below error: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm trying to duplicate logging output to the external services (for example LogTail) or at least to the file on the same server. Primary goal is to see exceptions (for both application itself and incoming requests) in LogTail and do not add huge amount of code to the app just for this purpose.
I've tried to follow https://docs.litestar.dev/latest/usage/logging.html and https://docs.litestar.dev/latest/usage/exceptions.html#exception-handling .
So far I was able to create separate FileHandler and add add it to LoggingConfig instance. However it does not log exceptions. It seems to be doable to log exceptions with some overrides, but in this case Litestar does not return appropriate responses to the client - exception returned to the log, client gets only "Internal server error".
I was not able to configure LogTail at all though. Here are their docs - https://betterstack.com/docs/logs/python/.
Both FileHandler and LogTail seem to be synchronous though . As a workaround for LogTail I can create dedicated async function that is doing httpx request. I just don't understand how to attach this function to the existing handler, so everything works the same way as it is with addition of LogTail logging.
Does anyone using external logging services with Litestar? Can you please share your experience on how to execute my own function in addition (not replacing) to the existing logging functionality?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions