-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When an error occurs in Log message invocation then log it as an ERROR #160
Comments
For reference, this is the original issue it was added: #22 It's not so obvious how to implement that, and what the logging level should be (error? warn?) because this methos is just returning a string. |
Thanks for the quick response. I like your idea of throwing an exception. If I've a problem in my code, the lambda in this case, I'd like to see it as an exception in my service, totally makes sense. |
in case system property is defined: kotlin-logging.throwOnMessageError
@kemalizing - please let me know if #161 PR looks as you expect. |
Looks good, thanks for the quick fix! Also, would be nice to mention it in your documentation. |
fixed in 2.0.4 and added some docs in the wiki: https://github.com/MicroUtils/kotlin-logging/wiki#q-what-happen-if-an-exception-is-thrown-when-creating-a-log-message |
Hi,
We are using kotlin-logging on many services on production. Today we figured out that if a message lambda fails, that incident is logged with the initial logging level, while it is actually an error. Which leads to some unexpected behavior.
Basically I'm speaking about this log
"Log message invocation failed: $e"
coming fromtoStringSafe
method.Is it possible to log that exception in ERROR level?
Thanks.
Kind regards
The text was updated successfully, but these errors were encountered: