Package org.apache.logging.log4j.core

Examples of org.apache.logging.log4j.core.LoggerContext.reconfigure()


        final String msg = "Message before reconfig";
        log.info(msg);

        final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
        ctx.reconfigure();
        ctx.reconfigure();
       
        final String msg2 = "Message after reconfig";
        log.info(msg2);
        ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
View Full Code Here


    public void testWithConfigProp() {
        System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
        System.setProperty("log4j.level", "debug");
        try {
            final LoggerContext ctx = (LoggerContext) LogManager.getContext();
            ctx.reconfigure();
            final Configuration config = ctx.getConfiguration();
            assertTrue("Configuration is not an XMLConfiguration", config instanceof XMLConfiguration);
        } finally {
            System.clearProperty("log4j.level");
View Full Code Here

        System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
        System.setProperty("log4j.level", "debug");
        System.setProperty("log.level", "debug");
        try {
            final LoggerContext ctx = (LoggerContext) LogManager.getContext();
            ctx.reconfigure();
            final Configuration config = ctx.getConfiguration();
            assertTrue("Configuration is not an XMLConfiguration", config instanceof XMLConfiguration);
        } finally {
            System.clearProperty("log4j.level");
            System.clearProperty("log.level");
View Full Code Here

        final LoggerContext ctx = (LoggerContext) LogManager.getContext();
        final Configuration config = ctx.getConfiguration();
        if (config instanceof XMLConfiguration) {
            final String name = ((XMLConfiguration) config).getName();
            if (name == null || !name.equals("XMLConfigTest")) {
                ctx.reconfigure();
            }
        } else {
            ctx.reconfigure();
        }
    }
View Full Code Here

            final String name = ((XMLConfiguration) config).getName();
            if (name == null || !name.equals("XMLConfigTest")) {
                ctx.reconfigure();
            }
        } else {
            ctx.reconfigure();
        }
    }

    @AfterClass
    public static void cleanupClass() {
View Full Code Here

    @AfterClass
    public static void cleanupClass() {
        System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
        final LoggerContext ctx = (LoggerContext) LogManager.getContext();
        ctx.reconfigure();
        StatusLogger.getLogger().reset();
        final File file = new File(STATUS_LOG);
        file.delete();
    }
View Full Code Here

        return NullEnumeration.getInstance();
    }

    static void reconfigure() {
        final LoggerContext ctx = (LoggerContext) PrivateManager.getContext();
        ctx.reconfigure();
    }

    /**
     * No-op implementation.
     */
 
View Full Code Here

    @BeforeClass
    public static void setupClass() {
        ConfigurationFactory.setConfigurationFactory(cf);
        final LoggerContext ctx = (LoggerContext) LogManager.getContext();
        ctx.reconfigure();
    }

    LoggerContext ctx = (LoggerContext) LogManager.getContext();

    Logger root = this.ctx.getLogger("");
View Full Code Here

    @BeforeClass
    public static void setupClass() {
        ConfigurationFactory.setConfigurationFactory(cf);
        final LoggerContext ctx = (LoggerContext) LogManager.getContext();
        ctx.reconfigure();
    }

    LoggerContext ctx = (LoggerContext) LogManager.getContext();

    Logger root = ctx.getLogger("");
View Full Code Here

    @BeforeClass
    public static void setupClass() {
        ConfigurationFactory.setConfigurationFactory(cf);
        final LoggerContext ctx = (LoggerContext) LogManager.getContext();
        ctx.reconfigure();
    }

    LoggerContext ctx = (LoggerContext) LogManager.getContext();

    Logger root = ctx.getLogger("");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.