/*
 * 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.core.appender;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 *
 */
public class AsyncAppenderShutdownTimeoutTest {
    private static final String CONFIG = "log4j-asynch-shutdownTimeout.xml";

    @BeforeClass
    public static void setupClass() {
        System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
    }

    @AfterClass
    public static void cleanupClass() {
        System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
    }

    @Test(timeout = 2000)
    public void shutdownTest() throws Exception {
        final LoggerContext ctx = (LoggerContext)LogManager.getContext(false);
        final Logger logger = ctx.getLogger("Logger");
        logger.info("This is a test");
        ctx.stop();
    }

}

@@ -1015,69 +1015,31 @@
 g4j.
-core.config.ConfigurationFactory;%0Aimport org.junit.AfterClass
+junit.LoggerContextRule
 ;%0Aim
@@ -1053,27 +1053,25 @@
 g.junit.
-Before
 Class
+Rule
 ;%0Aimport
@@ -1151,375 +1151,125 @@
 t %7B%0A
-    private static final String CONFIG = %22log4j-asynch-shutdownTimeout.xml%22;%0A%0A    @BeforeClass%0A    public static void setupClass() %7B%0A        System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);%0A    %7D%0A%0A    @AfterClass%0A    public static void cleanupClass() %7B%0A        System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);%0A    %7D
+%0A    @ClassRule%0A    public static LoggerContextRule init = new LoggerContextRule(%22log4j-asynch-shutdownTimeout.xml%22);
 %0A%0A  

Fix log config in test