From 2f4aa754451167e2fef98a07f2e1260cdb08b332 Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Sat, 10 Dec 2022 19:30:48 +0100 Subject: [PATCH] fix SLF4J-575 Signed-off-by: Ceki Gulcu --- slf4j-api/src/main/java/org/slf4j/LoggerFactory.java | 4 +++- .../main/java/org/slf4j/spi/LoggingEventAware.java | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java index 30b7d21a7..06828e5e3 100755 --- a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java +++ b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java @@ -304,7 +304,9 @@ private static void replaySingleEvent(SubstituteLoggingEvent event) { if (substLogger.isDelegateNOP()) { // nothing to do } else if (substLogger.isDelegateEventAware()) { - substLogger.log(event); + if(substLogger.isEnabledForLevel(event.getLevel())) { + substLogger.log(event); + } } else { Util.report(loggerName); } diff --git a/slf4j-api/src/main/java/org/slf4j/spi/LoggingEventAware.java b/slf4j-api/src/main/java/org/slf4j/spi/LoggingEventAware.java index 7ed2d509a..b833e40c5 100644 --- a/slf4j-api/src/main/java/org/slf4j/spi/LoggingEventAware.java +++ b/slf4j-api/src/main/java/org/slf4j/spi/LoggingEventAware.java @@ -4,7 +4,17 @@ /** * A logger capable of logging from org.slf4j.event.LoggingEvent implements this interface. - * + * + *

Please note that when the {@link #log(LoggingEvent)} method assumes that + * the event was filtered beforehand and no further filtering needs to occur by the method itself. + *

+ * + *

Implementations of this interface may apply further filtering but they are not + * required to do so. In other words, {@link #log(LoggingEvent)} method is free to assume that + * the event was filtered beforehand and no further filtering needs to occur in the method itself.

+ * + * See also https://jira.qos.ch/browse/SLF4J-575 + * * @author Ceki Gulcu * @since 2.0.0 */