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

Disable log.error to be sent as Issues #3890

Answered by adinauer
sebasira asked this question in Q&A
Discussion options

I've recently trying Sentry. I like it very much, there's just one thing I do not know how to solve.

I'm using the starter and the logback dependencies. In application.properties configure a few things. And that's all I've got for Sentry.

Issues reach the Sentry server and I can see them.

The problem I having is that I use a lot log.error. And as default they every log.error is sent to Sentry and treated as issue. That flood the dashboard and I miss the real important for me.

Is there a simple way (preferible via application.properties) to instruct Sentry not to grab log.error and send them as issues? I do want to keep breadcrumbs, I just don't want that a log messages is treated as an issue.

Thank you!

You must be logged in to vote

Hey @sebasira , you could filter events in beforeSend. Heres some docs for it. The easiest way to register it for a Spring Boot application is to register a bean:

 @Bean
 public SentryOptions.BeforeSendCallback beforeSendCallback() {
 return ((event, hint) -> {
 if (event.getLogger() != null) {
 return null;
 }
 return event;
 });
 }

Replies: 2 comments 2 replies

Comment options

Hey @sebasira , you could filter events in beforeSend. Heres some docs for it. The easiest way to register it for a Spring Boot application is to register a bean:

 @Bean
 public SentryOptions.BeforeSendCallback beforeSendCallback() {
 return ((event, hint) -> {
 if (event.getLogger() != null) {
 return null;
 }
 return event;
 });
 }
You must be logged in to vote
0 replies
Answer selected by sebasira
Comment options

Thank you @adinauer ! I'll try that.

One more question related to this.
Also some times when I catch an exception I print the stack trace so if the problem is bigger I could understand what's going on. So for example I have.

} catch (SomeException ex){
 log.error("Something went wrong with.......");
 ex.printStackTrace()
 ...
 ...
}

And in the Sentry dashboard I see the log.error (which you told me how to disable) and also the stackTrace. How can I also skip sending the stackTrace?

You must be logged in to vote
2 replies
Comment options

That stack trace should also be coming from log.error and go away at the same time as ex.printStackTrace() just prints to Standard.err which shouldn't be intercepted and thus not sent to Sentry.

Comment options

Nice! Thank you for your assistance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

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