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
Logging with brackets (lazy) eats the eventual exceptions #260
Comments
Thank you for reporting an issue. See the wiki for documentation and slack for questions. |
I see, thx for the quick reply.
Still I believe letting the exception pass (instead or eating it) should
definitely be the default behavior.
This is a big surprise for beginners (like me) and a reason to avoid this
library.
For example the code below behaves very differently, on the same logging
level ! :
fun main(args: Array<String>) {
log.info{"This cannot be converted to int!".toInt()}
log.info("I'm not supposed to see this line!")
versus
fun main(args: Array<String>) {
log.info("This cannot be converted to int!".toInt()) // replacing "{}"
with "()" completely changes the code path!
log.info("I'm not supposed to see this line!")
I hope this makes sense,
Petru
…On Fri, Nov 4, 2022 at 2:00 PM Ohad Shai ***@***.***> wrote:
This was introduced in #22
<#22> and later
discussed in #160
<#160>. Id you start
the jvm with -Dkotlin-logging.throwOnMessageError it will throw the
exception instead of logging it.
—
Reply to this email directly, view it on GitHub
<#260 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYAVA3CDXZPP5NW7C3IQ4TWGVFNPANCNFSM6AAAAAARXNCL3I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Petri
|
You can see in issue 22 why we made that the default: #22 (comment) Mostly because that's how other framework works. |
Thanks for help Ohad, very useful.
Petru
…On Fri, Nov 4, 2022, 4:07 PM Ohad Shai ***@***.***> wrote:
You can see in issue 22 why we made that the default: #22 (comment)
<#22 (comment)>
Mostly because that's how other framework works.
—
Reply to this email directly, view it on GitHub
<#260 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYAVAYALIZG3W3EF3T5G3LWGVUJNANCNFSM6AAAAAARXNCL3I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example the following simple code is supposed to fail:
However it does not fail:
This is unexpected: logging is not supposed to catch any user exceptions, it should not affect the intended path in any way.
Thanks,
Petru
The text was updated successfully, but these errors were encountered: