You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2024/09/09 20:13:22 UTC
(logging-log4j2) branch feature/2.x/deprecate-AL-checkMF created (now 9a70d3a41b)
This is an automated email from the ASF dual-hosted git repository.
vy pushed a change to branch feature/2.x/deprecate-AL-checkMF
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
at 9a70d3a41b Deprecate `AbstractLogger.checkMessageFactory()`
This branch includes the following new commits:
new 9a70d3a41b Deprecate `AbstractLogger.checkMessageFactory()`
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(logging-log4j2) 01/01: Deprecate `AbstractLogger.checkMessageFactory()`
Posted by vy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch feature/2.x/deprecate-AL-checkMF
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 9a70d3a41b7bb9993b80d155bab160b72568f63f
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Mon Sep 9 22:13:32 2024 +0200
Deprecate `AbstractLogger.checkMessageFactory()`
---
.../java/org/apache/logging/log4j/simple/SimpleLoggerContext.java | 1 -
.../main/java/org/apache/logging/log4j/spi/AbstractLogger.java | 3 +++
.../main/java/org/apache/logging/log4j/core/LoggerContext.java | 1 -
.../org/apache/logging/log4j/taglib/Log4jTaglibLoggerContext.java | 1 -
.../.2.x.x/deprecate_AbstractLogger_checkMessageFactory.xml | 8 ++++++++
5 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java b/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java
index d1aaf8db0f..7ac6871bb8 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/simple/SimpleLoggerContext.java
@@ -100,7 +100,6 @@ public class SimpleLoggerContext implements LoggerContext {
// Note: This is the only method where we add entries to the 'loggerRegistry' ivar.
final ExtendedLogger extendedLogger = loggerRegistry.getLogger(name, messageFactory);
if (extendedLogger != null) {
- AbstractLogger.checkMessageFactory(extendedLogger, messageFactory);
return extendedLogger;
}
final SimpleLogger simpleLogger = new SimpleLogger(
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
index ecc499ac58..5011900fd2 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
@@ -166,7 +166,10 @@ public abstract class AbstractLogger implements ExtendedLogger, LocationAwareLog
*
* @param logger The logger to check
* @param messageFactory The message factory to check.
+ * @deprecated Planned to be removed!
+ * Instead, in {@link LoggerContext#getLogger(String, MessageFactory)} implementations, namespace loggers with message factories.
*/
+ @Deprecated
public static void checkMessageFactory(final ExtendedLogger logger, final MessageFactory messageFactory) {
final String name = logger.getName();
final MessageFactory loggerMessageFactory = logger.getMessageFactory();
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
index 07cd2d1f59..674c4ef98c 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
@@ -527,7 +527,6 @@ public class LoggerContext extends AbstractLifeCycle
// Note: This is the only method where we add entries to the 'loggerRegistry' ivar.
Logger logger = loggerRegistry.getLogger(name, messageFactory);
if (logger != null) {
- AbstractLogger.checkMessageFactory(logger, messageFactory);
return logger;
}
diff --git a/log4j-taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLoggerContext.java b/log4j-taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLoggerContext.java
index 3c76f39b21..6253659811 100644
--- a/log4j-taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLoggerContext.java
+++ b/log4j-taglib/src/main/java/org/apache/logging/log4j/taglib/Log4jTaglibLoggerContext.java
@@ -60,7 +60,6 @@ final class Log4jTaglibLoggerContext implements LoggerContext {
// Note: This is the only method where we add entries to the 'loggerRegistry' ivar.
Log4jTaglibLogger logger = this.loggerRegistry.getLogger(name, messageFactory);
if (logger != null) {
- AbstractLogger.checkMessageFactory(logger, messageFactory);
return logger;
}
diff --git a/src/changelog/.2.x.x/deprecate_AbstractLogger_checkMessageFactory.xml b/src/changelog/.2.x.x/deprecate_AbstractLogger_checkMessageFactory.xml
new file mode 100644
index 0000000000..62cbc2d837
--- /dev/null
+++ b/src/changelog/.2.x.x/deprecate_AbstractLogger_checkMessageFactory.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="https://logging.apache.org/xml/ns"
+ xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
+ type="deprecated">
+ <issue id="xxx" link="https://github.com/apache/logging-log4j2/pull/xxx"/>
+ <description format="asciidoc">Deprecate `AbstractLogger.checkMessageFactory()`, since all created `Logger`s are already `MessageFactory`-namespaced</description>
+</entry>