-
-
Notifications
You must be signed in to change notification settings - Fork 458
-
Is it possible to log method variables when error occurred ?
Because right now it's still needed to add more debug into methods and reproduce error to show real data in methods.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 3 comments
-
Hello @vvatlin are you asking about manually adding parameters when manually capturing an exception or would you like to see this in a specific integration that automatically captures exceptions?
Beta Was this translation helpful? Give feedback.
All reactions
-
I would prefer second option with automatic captures exceptions.
The problem:
Right now I can see an error: javax.persistence.NonUniqueResultException: query did not return a unique result: 2
and nothing else, I can't understand what parameters was passed to this method. For example findUserByEmail, but what email we used to search the user ?
Now I have to go to the method and add additional logging. But the signature of my method is
findUserByEmail(String email); So I hope that it's possible to grab String email, and display this together with stack trace.
Beta Was this translation helpful? Give feedback.
All reactions
-
I assume you're asking about the JDBC integration in this case. It wouldn't help with your use case because it would only log the prepared statement without values. So you still wouldn't be able to see the email address used for the search.
A non ideal workaround would be to add the params as breadcrumbs.
As a potential future improvement we could have some Annotation that marks a method we'd like to record input params of.
Which framework are you using? Spring?
Beta Was this translation helpful? Give feedback.