mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-17 13:45:54 +00:00
fix(): also check exceptions/stack trace when filtering log messages (#10391)
Co-authored-by: John Joyce <john@acryl.io>
This commit is contained in:
parent
581dc7ffe2
commit
87ff19ed48
@ -1,6 +1,8 @@
|
|||||||
package com.linkedin.metadata.utils.log;
|
package com.linkedin.metadata.utils.log;
|
||||||
|
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
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.filter.AbstractMatcherFilter;
|
||||||
import ch.qos.logback.core.spi.FilterReply;
|
import ch.qos.logback.core.spi.FilterReply;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -21,7 +23,21 @@ public class LogMessageFilter extends AbstractMatcherFilter<ILoggingEvent> {
|
|||||||
return FilterReply.NEUTRAL;
|
return FilterReply.NEUTRAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.excluded.stream().anyMatch(message -> event.getFormattedMessage().contains(message))) {
|
final String formattedMessage = event.getFormattedMessage();
|
||||||
|
final IThrowableProxy throwableProxy = event.getThrowableProxy();
|
||||||
|
|
||||||
|
String throwableString;
|
||||||
|
if (throwableProxy != null) {
|
||||||
|
throwableString = ThrowableProxyUtil.asString(throwableProxy);
|
||||||
|
} else {
|
||||||
|
throwableString = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.excluded.stream()
|
||||||
|
.anyMatch(
|
||||||
|
message ->
|
||||||
|
formattedMessage.contains(message)
|
||||||
|
|| (throwableString != null && throwableString.contains(message)))) {
|
||||||
return FilterReply.DENY;
|
return FilterReply.DENY;
|
||||||
}
|
}
|
||||||
return FilterReply.ACCEPT;
|
return FilterReply.ACCEPT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user