@@ -0,0 +1,2640 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements. See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache license, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License. You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the license for the specific language governing permissions and%0A * limitations under the license.%0A */%0Apackage org.apache.log4j;%0A%0Aimport java.util.List;%0A%0Aimport org.apache.logging.log4j.junit.InitialLoggerContext;%0Aimport org.apache.logging.log4j.test.appender.ListAppender;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class CallerInformationTest %7B%0A%0A    // config from log4j-core test-jar%0A    private static final String CONFIG = %22log4j2-calling-class.xml%22;%0A%0A    @Rule%0A    public final InitialLoggerContext ctx = new InitialLoggerContext(CONFIG);%0A%0A    @Test%0A    public void testClassLogger() throws Exception %7B%0A        final ListAppender app = ctx.getListAppender(%22Class%22).clear();%0A        final Logger logger = Logger.getLogger(%22ClassLogger%22);%0A        logger.info(%22Ignored message contents.%22);%0A        logger.warn(%22Verifying the caller class is still correct.%22);%0A        logger.error(%22Hopefully nobody breaks me!%22);%0A        final List%3CString%3E messages = app.getMessages();%0A        assertEquals(%22Incorrect number of messages.%22, 3, messages.size());%0A        for (final String message : messages) %7B%0A            assertEquals(%22Incorrect caller class name.%22, this.getClass().getName(), message);%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void testMethodLogger() throws Exception %7B%0A        final ListAppender app = ctx.getListAppender(%22Method%22).clear();%0A        final Logger logger = Logger.getLogger(%22MethodLogger%22);%0A        logger.info(%22More messages.%22);%0A        logger.warn(%22CATASTROPHE INCOMING!%22);%0A        logger.error(%22ZOMBIES!!!%22);%0A        logger.warn(%22brains~~~%22);%0A        logger.info(%22Itchy. Tasty.%22);%0A        final List%3CString%3E messages = app.getMessages();%0A        assertEquals(%22Incorrect number of messages.%22, 5, messages.size());%0A        for (final String message : messages) %7B%0A            assertEquals(%22Incorrect caller method name.%22, %22testMethodLogger%22, message);%0A        %7D%0A    %7D%0A%7D%0A

Add CallerInformationTest to log4j-1.2-api.