Skip to content
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

fix: also check exceptions/stack trace when filtering log messages #10391

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.linkedin.metadata.utils.log;

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.IThrowableProxy;
import ch.qos.logback.classic.spi.ThrowableProxyUtil;
import ch.qos.logback.core.filter.AbstractMatcherFilter;
import ch.qos.logback.core.spi.FilterReply;
import java.util.ArrayList;
Expand All @@ -21,7 +23,21 @@ public FilterReply decide(ILoggingEvent event) {
return FilterReply.NEUTRAL;
}

if (this.excluded.stream().anyMatch(message -> event.getFormattedMessage().contains(message))) {
final String formattedMessage = event.getFormattedMessage();

IThrowableProxy throwbleProxy = event.getThrowableProxy();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: throwableProxy

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill edit this for u then we can merge

final String throwableString;
if (throwbleProxy != null) {
throwableString = ThrowableProxyUtil.asString(throwbleProxy);
} else {
throwableString = "";
}

if (this.excluded.stream()
.anyMatch(
message ->
formattedMessage.contains(message)
|| (!throwableString.equals("") && throwableString.contains(message)))) {
return FilterReply.DENY;
}
return FilterReply.ACCEPT;
Expand Down
Loading