/*
 * 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.logging.log4j.jcl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.spi.AbstractLoggerAdapter;
import org.apache.logging.log4j.spi.ExtendedLogger;
import org.apache.logging.log4j.spi.LoggerContext;

/**
 * Commons Logging registry.
 */
public class LogAdapter extends AbstractLoggerAdapter<Log> {

    @Override
    protected Log newLogger(final String name, final LoggerContext context) {
        return new Log4jLog(PrivateManager.getLogger(name));
    }

    @Override
    protected LoggerContext getContext() {
        return PrivateManager.getContext();
    }

    /**
     * The real bridge between commons logging and Log4j.
     */
    private static class PrivateManager extends LogManager {
        private static final String FQCN = LogFactory.class.getName();

        public static LoggerContext getContext() {
            return getContext(FQCN, false);
        }

        public static ExtendedLogger getLogger(final String name) {
            return getContext().getLogger(name);
        }
    }

}

@@ -922,52 +922,8 @@
 ry;%0A
-import org.apache.logging.log4j.LogManager;%0A
 impo
@@ -1013,30 +1013,29 @@
 g4j.spi.
-ExtendedLogger
+LoggerContext
 ;%0Aimport
@@ -1060,33 +1060,35 @@
 g.log4j.
-spi.LoggerContext
+util.ReflectionUtil
 ;%0A%0A/**%0A 
@@ -1105,16 +1105,24 @@
 Logging 
+adapter 
 registry
@@ -1123,16 +1123,33 @@
 gistry.%0A
+ *%0A * @since 2.1%0A
  */%0Apubl
@@ -1326,30 +1326,23 @@
 og4jLog(
-PrivateManager
+context
 .getLogg
@@ -1435,483 +1435,68 @@
 urn 
-PrivateManager.getContext();%0A    %7D%0A%0A    /**%0A     * The real bridge between commons logging and Log4j.%0A     */%0A    private static class PrivateManager extends LogManager %7B%0A        private static final String FQCN = LogFactory.class.getName();%0A%0A        public static LoggerContext getContext() %7B%0A            return getContext(FQCN, false);%0A        %7D%0A%0A        public static ExtendedLogger getLogger(final String name) %7B%0A            return getContext().getLogger(name);%0A        %7D
+getContext(ReflectionUtil.getCallerClass(LogFactory.class));
 %0A   

Simplify log4j-jcl LoggerAdapter implementation.