Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

show method variables #2403

Unanswered
vvatlin asked this question in Q&A
Discussion options

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.

You must be logged in to vote

Replies: 3 comments

Comment options

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?

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

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?

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /