diff --git a/src/main/java/org/jboss/logmanager/LogManager.java b/src/main/java/org/jboss/logmanager/LogManager.java index 0450ccc7..5961095d 100644 --- a/src/main/java/org/jboss/logmanager/LogManager.java +++ b/src/main/java/org/jboss/logmanager/LogManager.java @@ -32,7 +32,6 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiFunction; import java.util.function.Function; -import java.util.logging.Filter; import org.jboss.logmanager.configuration.PropertyLogContextConfigurator; @@ -43,9 +42,6 @@ */ public final class LogManager extends java.util.logging.LogManager { - public static final String PER_THREAD_LOG_FILTER_KEY = "org.jboss.logmanager.useThreadLocalFilter"; - static final boolean PER_THREAD_LOG_FILTER; - static { if (System.getSecurityManager() == null) { try { @@ -53,14 +49,7 @@ public final class LogManager extends java.util.logging.LogManager { Class.forName(StandardOutputStreams.class.getName()); } catch (ClassNotFoundException ignore) { } - PER_THREAD_LOG_FILTER = Boolean.getBoolean(PER_THREAD_LOG_FILTER_KEY); } else { - PER_THREAD_LOG_FILTER = AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Boolean run() { - return Boolean.getBoolean(PER_THREAD_LOG_FILTER_KEY); - } - }); AccessController.doPrivileged(new PrivilegedAction() { @Override @@ -76,10 +65,6 @@ public Object run() { } } - private static class LocalFilterHolder { - static final ThreadLocal LOCAL_FILTER = new ThreadLocal<>(); - } - /** * Construct a new logmanager instance. Attempts to plug a known memory leak in {@link java.util.logging.Level} as * well. @@ -237,30 +222,4 @@ public boolean addLogger(java.util.logging.Logger logger) { public Logger getLogger(String name) { return LogContext.getLogContext().getLogger(name); } - - /** - * Returns the currently set filter for this thread or {@code null} if one has not been set. - *

- * If the {@link #PER_THREAD_LOG_FILTER_KEY} is not set to {@code true} then {@code null} will always be returned. - *

- * - * @return the filter set for the thread or {@code null} if no level was set - */ - public static Filter getThreadLocalLogFilter() { - return PER_THREAD_LOG_FILTER ? LocalFilterHolder.LOCAL_FILTER.get() : null; - } - - /** - * Sets the filter on the thread for all loggers. - *

- * This feature only works if the {@link #PER_THREAD_LOG_FILTER} was set to {@code true} - *

- * - * @param filter the filter to set for all loggers on this thread - */ - public static void setThreadLocalLogLevel(final Filter filter) { - if (PER_THREAD_LOG_FILTER) { - LocalFilterHolder.LOCAL_FILTER.set(filter); - } - } } diff --git a/src/main/java/org/jboss/logmanager/Logger.java b/src/main/java/org/jboss/logmanager/Logger.java index 6863fe55..51ee2f8f 100644 --- a/src/main/java/org/jboss/logmanager/Logger.java +++ b/src/main/java/org/jboss/logmanager/Logger.java @@ -396,13 +396,7 @@ public LogContext getLogContext() { /** {@inheritDoc} */ public void log(LogRecord record) { - Filter filter = null; - final int effectiveLevel = loggerNode.getEffectiveLevel(); - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(record.getLevel().intValue())) { - return; - } - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(record)) { + if (!loggerNode.isLoggableLevel(record.getLevel().intValue())) { return; } logRaw(record); @@ -410,42 +404,30 @@ public void log(LogRecord record) { /** {@inheritDoc} */ public void entering(final String sourceClass, final String sourceMethod) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINER_INT)) { + if (!loggerNode.isLoggableLevel(FINER_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINER, "ENTRY", LOGGER_CLASS_NAME); rec.setSourceClassName(sourceClass); rec.setSourceMethodName(sourceMethod); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void entering(final String sourceClass, final String sourceMethod, final Object param1) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINER_INT)) { + if (!loggerNode.isLoggableLevel(FINER_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINER, "ENTRY {0}", LOGGER_CLASS_NAME); rec.setSourceClassName(sourceClass); rec.setSourceMethodName(sourceMethod); rec.setParameters(new Object[] { param1 }); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void entering(final String sourceClass, final String sourceMethod, final Object[] params) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINER_INT)) { + if (!loggerNode.isLoggableLevel(FINER_INT)) { return; } final StringBuilder builder = new StringBuilder("ENTRY"); @@ -458,404 +440,269 @@ public void entering(final String sourceClass, final String sourceMethod, final rec.setSourceMethodName(sourceMethod); if (params != null) rec.setParameters(params); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void exiting(final String sourceClass, final String sourceMethod) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINER_INT)) { + if (!loggerNode.isLoggableLevel(FINER_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINER, "RETURN", LOGGER_CLASS_NAME); rec.setSourceClassName(sourceClass); rec.setSourceMethodName(sourceMethod); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void exiting(final String sourceClass, final String sourceMethod, final Object result) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINER_INT)) { + if (!loggerNode.isLoggableLevel(FINER_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINER, "RETURN {0}", LOGGER_CLASS_NAME); rec.setSourceClassName(sourceClass); rec.setSourceMethodName(sourceMethod); rec.setParameters(new Object[] { result }); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void throwing(final String sourceClass, final String sourceMethod, final Throwable thrown) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINER_INT)) { + if (!loggerNode.isLoggableLevel(FINER_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINER, "THROW", LOGGER_CLASS_NAME); rec.setSourceClassName(sourceClass); rec.setSourceMethodName(sourceMethod); rec.setThrown(thrown); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void severe(final String msg) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(SEVERE_INT)) { + if (!loggerNode.isLoggableLevel(SEVERE_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.SEVERE, msg, LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void severe(final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(SEVERE_INT)) { + if (!loggerNode.isLoggableLevel(SEVERE_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.SEVERE, msgSupplier.get(), LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void warning(final String msg) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(WARNING_INT)) { + if (!loggerNode.isLoggableLevel(WARNING_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.WARNING, msg, LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void warning(final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(WARNING_INT)) { + if (!loggerNode.isLoggableLevel(WARNING_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.WARNING, msgSupplier.get(), LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void info(final String msg) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(INFO_INT)) { + if (!loggerNode.isLoggableLevel(INFO_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.INFO, msg, LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void info(final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(INFO_INT)) { + if (!loggerNode.isLoggableLevel(INFO_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.INFO, msgSupplier.get(), LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void config(final String msg) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(CONFIG_INT)) { + if (!loggerNode.isLoggableLevel(CONFIG_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.CONFIG, msg, LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void config(final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(CONFIG_INT)) { + if (!loggerNode.isLoggableLevel(CONFIG_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.CONFIG, msgSupplier.get(), LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void fine(final String msg) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINE_INT)) { + if (!loggerNode.isLoggableLevel(FINE_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINE, msg, LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void fine(final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINE_INT)) { + if (!loggerNode.isLoggableLevel(FINE_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINE, msgSupplier.get(), LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void finer(final String msg) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINER_INT)) { + if (!loggerNode.isLoggableLevel(FINER_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINER, msg, LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void finer(final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINER_INT)) { + if (!loggerNode.isLoggableLevel(FINER_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINER, msgSupplier.get(), LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void finest(final String msg) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINEST_INT)) { + if (!loggerNode.isLoggableLevel(FINEST_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINEST, msg, LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void finest(final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(FINEST_INT)) { + if (!loggerNode.isLoggableLevel(FINEST_INT)) { return; } final ExtLogRecord rec = new ExtLogRecord(Level.FINEST, msgSupplier.get(), LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void log(final Level level, final String msg) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msg, LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void log(final Level level, final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msgSupplier.get(), LOGGER_CLASS_NAME); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void log(final Level level, final String msg, final Object param1) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msg, LOGGER_CLASS_NAME); rec.setParameters(new Object[] { param1 }); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void log(final Level level, final String msg, final Object[] params) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msg, LOGGER_CLASS_NAME); if (params != null) rec.setParameters(params); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void log(final Level level, final String msg, final Throwable thrown) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msg, LOGGER_CLASS_NAME); rec.setThrown(thrown); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void log(final Level level, final Throwable thrown, final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msgSupplier.get(), LOGGER_CLASS_NAME); rec.setThrown(thrown); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void logp(final Level level, final String sourceClass, final String sourceMethod, final String msg) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msg, LOGGER_CLASS_NAME); rec.setSourceClassName(sourceClass); rec.setSourceMethodName(sourceMethod); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void logp(final Level level, final String sourceClass, final String sourceMethod, final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msgSupplier.get(), LOGGER_CLASS_NAME); rec.setSourceClassName(sourceClass); rec.setSourceMethodName(sourceMethod); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void logp(final Level level, final String sourceClass, final String sourceMethod, final String msg, final Object param1) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msg, LOGGER_CLASS_NAME); rec.setSourceClassName(sourceClass); rec.setSourceMethodName(sourceMethod); rec.setParameters(new Object[] { param1 }); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void logp(final Level level, final String sourceClass, final String sourceMethod, final String msg, final Object[] params) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msg, LOGGER_CLASS_NAME); @@ -863,45 +710,32 @@ public void logp(final Level level, final String sourceClass, final String sourc rec.setSourceMethodName(sourceMethod); if (params != null) rec.setParameters(params); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } /** {@inheritDoc} */ public void logp(final Level level, final String sourceClass, final String sourceMethod, final String msg, final Throwable thrown) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msg, LOGGER_CLASS_NAME); rec.setSourceClassName(sourceClass); rec.setSourceMethodName(sourceMethod); rec.setThrown(thrown); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @Override public void logp(final Level level, final String sourceClass, final String sourceMethod, final Throwable thrown, final Supplier msgSupplier) { - Filter filter = null; - if (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, msgSupplier.get(), LOGGER_CLASS_NAME); rec.setSourceClassName(sourceClass); rec.setSourceMethodName(sourceMethod); rec.setThrown(thrown); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @@ -909,8 +743,7 @@ public void logp(final Level level, final String sourceClass, final String sourc @Deprecated(since = "3.0", forRemoval = true) public void logrb(final Level level, final String sourceClass, final String sourceMethod, final String bundleName, final String msg) { - if (!(LogManager.PER_THREAD_LOG_FILTER && LogManager.getThreadLocalLogFilter() != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } // No local check is needed here as this will delegate to log(LogRecord) @@ -921,8 +754,7 @@ public void logrb(final Level level, final String sourceClass, final String sour @Deprecated(since = "3.0", forRemoval = true) public void logrb(final Level level, final String sourceClass, final String sourceMethod, final String bundleName, final String msg, final Object param1) { - if (!(LogManager.PER_THREAD_LOG_FILTER && LogManager.getThreadLocalLogFilter() != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } // No local check is needed here as this will delegate to log(LogRecord) @@ -933,8 +765,7 @@ public void logrb(final Level level, final String sourceClass, final String sour @Deprecated(since = "3.0", forRemoval = true) public void logrb(final Level level, final String sourceClass, final String sourceMethod, final String bundleName, final String msg, final Object[] params) { - if (!(LogManager.PER_THREAD_LOG_FILTER && LogManager.getThreadLocalLogFilter() != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } // No local check is needed here as this will delegate to log(LogRecord) @@ -945,8 +776,7 @@ public void logrb(final Level level, final String sourceClass, final String sour @Deprecated(since = "3.0", forRemoval = true) public void logrb(final Level level, final String sourceClass, final String sourceMethod, final String bundleName, final String msg, final Throwable thrown) { - if (!(LogManager.PER_THREAD_LOG_FILTER && LogManager.getThreadLocalLogFilter() != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } // No local check is needed here as this will delegate to log(LogRecord) @@ -956,8 +786,7 @@ public void logrb(final Level level, final String sourceClass, final String sour @Override public void logrb(final Level level, final String sourceClass, final String sourceMethod, final ResourceBundle bundle, final String msg, final Object... params) { - if (!(LogManager.PER_THREAD_LOG_FILTER && LogManager.getThreadLocalLogFilter() != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } // No local check is needed here as this will delegate to log(LogRecord) @@ -966,8 +795,7 @@ public void logrb(final Level level, final String sourceClass, final String sour @Override public void logrb(final Level level, final ResourceBundle bundle, final String msg, final Object... params) { - if (!(LogManager.PER_THREAD_LOG_FILTER && LogManager.getThreadLocalLogFilter() != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } // No local check is needed here as this will delegate to log(LogRecord) @@ -977,8 +805,7 @@ public void logrb(final Level level, final ResourceBundle bundle, final String m @Override public void logrb(final Level level, final String sourceClass, final String sourceMethod, final ResourceBundle bundle, final String msg, final Throwable thrown) { - if (!(LogManager.PER_THREAD_LOG_FILTER && LogManager.getThreadLocalLogFilter() != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } // No local check is needed here as this will delegate to log(LogRecord) @@ -987,8 +814,7 @@ public void logrb(final Level level, final String sourceClass, final String sour @Override public void logrb(final Level level, final ResourceBundle bundle, final String msg, final Throwable thrown) { - if (!(LogManager.PER_THREAD_LOG_FILTER && LogManager.getThreadLocalLogFilter() != null) - && !loggerNode.isLoggableLevel(level.intValue())) { + if (!loggerNode.isLoggableLevel(level.intValue())) { return; } // No local check is needed here as this will delegate to log(LogRecord) @@ -1009,19 +835,14 @@ public void logrb(final Level level, final ResourceBundle bundle, final String m */ public void log(final String fqcn, final Level level, final String message, final String bundleName, final ExtLogRecord.FormatStyle style, final Object[] params, final Throwable t) { - Filter filter = null; if (level == null || fqcn == null || message == null - || (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - || !loggerNode.isLoggableLevel(level.intValue()))) { + || !loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, message, style, fqcn); rec.setResourceBundleName(bundleName); rec.setParameters(params); rec.setThrown(t); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); } @@ -1037,18 +858,13 @@ public void log(final String fqcn, final Level level, final String message, fina */ public void log(final String fqcn, final Level level, final String message, final ExtLogRecord.FormatStyle style, final Object[] params, final Throwable t) { - Filter filter = null; if (level == null || fqcn == null || message == null - || (!(LogManager.PER_THREAD_LOG_FILTER && (filter = LogManager.getThreadLocalLogFilter()) != null) - && !loggerNode.isLoggableLevel(level.intValue()))) { + || !loggerNode.isLoggableLevel(level.intValue())) { return; } final ExtLogRecord rec = new ExtLogRecord(level, message, style, fqcn); rec.setParameters(params); rec.setThrown(t); - if (LogManager.PER_THREAD_LOG_FILTER && filter != null && !filter.isLoggable(rec)) { - return; - } logRaw(rec); }