Index: log4j-1.2-api/src/main/java/org/apache/log4j/spi/LoggerFactoryBridge.java
===================================================================
--- log4j-1.2-api/src/main/java/org/apache/log4j/spi/LoggerFactoryBridge.java (revision b77edb7ce1a53f4ce9d87c9cab34ea8a3f90080a)
+++ log4j-1.2-api/src/main/java/org/apache/log4j/spi/LoggerFactoryBridge.java (revision b77edb7ce1a53f4ce9d87c9cab34ea8a3f90080a)
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.log4j.spi;
-
-import org.apache.log4j.Logger;
-
-/**
- *
- * Implement this interface to create new instances of Logger or a sub-class of Logger when instantiating with specific
- * context.
- *
- *
- * See examples/subclass/MyLogger.java for an example.
- *
- *
- * @since 2.6
- */
-public interface LoggerFactoryBridge {
-
- Logger makeNewLoggerInstance(org.apache.logging.log4j.core.LoggerContext context, String name);
-
-}
\ No newline at end of file
Index: log4j-1.2-api/src/main/java/org/apache/log4j/Category.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- log4j-1.2-api/src/main/java/org/apache/log4j/Category.java (revision b77edb7ce1a53f4ce9d87c9cab34ea8a3f90080a)
+++ log4j-1.2-api/src/main/java/org/apache/log4j/Category.java (revision )
@@ -25,13 +25,13 @@
import org.apache.log4j.helpers.NullEnumeration;
import org.apache.log4j.spi.LoggerFactory;
-import org.apache.log4j.spi.LoggerFactoryBridge;
import org.apache.log4j.spi.LoggingEvent;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.util.NameUtil;
import org.apache.logging.log4j.message.LocalizedMessage;
import org.apache.logging.log4j.message.Message;
import org.apache.logging.log4j.message.ObjectMessage;
+import org.apache.logging.log4j.spi.AbstractLoggerAdapter;
import org.apache.logging.log4j.util.Strings;
@@ -40,7 +40,7 @@
*/
public class Category {
- private static LoggerFactoryBridge loggerFactory = new PrivateFactory();
+ private static PrivateAdapter adapter = new PrivateAdapter();
private static final Map> CONTEXT_MAP =
new WeakHashMap<>();
@@ -76,11 +76,11 @@
}
public static Category getInstance(final String name) {
- return getInstance(PrivateManager.getContext(), name, loggerFactory);
+ return getInstance(PrivateManager.getContext(), name, adapter);
}
static Logger getInstance(final LoggerContext context, final String name) {
- return getInstance(context, name, loggerFactory);
+ return getInstance(context, name, adapter);
}
static Logger getInstance(final LoggerContext context, final String name, final LoggerFactory factory) {
@@ -94,13 +94,13 @@
return prev == null ? logger : prev;
}
- static Logger getInstance(final LoggerContext context, final String name, final LoggerFactoryBridge factory) {
+ static Logger getInstance(final LoggerContext context, final String name, final PrivateAdapter factory) {
final ConcurrentMap loggers = getLoggersMap(context);
Logger logger = loggers.get(name);
if (logger != null) {
return logger;
}
- logger = factory.makeNewLoggerInstance(context, name);
+ logger = factory.newLogger(name, context);
final Logger prev = loggers.putIfAbsent(name, logger);
return prev == null ? logger : prev;
}
@@ -453,14 +453,16 @@
}
}
- /**
- * Private logger factory.
- */
- private static class PrivateFactory implements LoggerFactoryBridge {
+ private static class PrivateAdapter extends AbstractLoggerAdapter {
@Override
- public Logger makeNewLoggerInstance(org.apache.logging.log4j.core.LoggerContext context, final String name) {
- return new Logger(context, name);
+ protected Logger newLogger(final String name, final org.apache.logging.log4j.spi.LoggerContext context) {
+ return new Logger((LoggerContext) context, name);
+ }
+
+ @Override
+ protected org.apache.logging.log4j.spi.LoggerContext getContext() {
+ return PrivateManager.getContext();
}
}