Package org.apache.logging.log4j.core.config

Examples of org.apache.logging.log4j.core.config.Configuration


     */
    public synchronized Configuration setConfiguration(Configuration config) {
        if (config == null) {
            throw new NullPointerException("No Configuration was provided");
        }
        Configuration prev = this.config;
        config.addListener(this);
        config.start();
        this.config = config;
        updateLoggers();
        if (prev != null) {
            prev.removeListener(this);
            prev.stop();
        }
        return prev;
    }
View Full Code Here


    /**
     *  Reconfigure the context.
     */
    public synchronized void reconfigure() {
        logger.debug("Reconfiguration started for context " + name);
        Configuration instance = ConfigurationFactory.getInstance().getConfiguration(name, configLocation);
        setConfiguration(instance);
        /*instance.start();
        Configuration old = setConfiguration(instance);
        updateLoggers();
        if (old != null) {
View Full Code Here

     * Cause a reconfiguration to take place when the underlying configuration file changes.
     * @param reconfigurable The Configuration that can be reconfigured.
     */
    public synchronized void onChange(Reconfigurable reconfigurable) {
        logger.debug("Reconfiguration started for context " + name);
        Configuration config = reconfigurable.reconfigure();
        if (config != null) {
            setConfiguration(config);
            logger.debug("Reconfiguration completed");
        } else {
            logger.debug("Reconfiguration failed");
View Full Code Here

     */
    public synchronized Configuration setConfiguration(Configuration config) {
        if (config == null) {
            throw new NullPointerException("No Configuration was provided");
        }
        Configuration prev = this.config;
        config.addListener(this);
        config.start();
        this.config = config;
        updateLoggers();
        if (prev != null) {
            prev.removeListener(this);
            prev.stop();
        }
        return prev;
    }
View Full Code Here

    /**
     *  Reconfigure the context.
     */
    public synchronized void reconfigure() {
        logger.debug("Reconfiguration started for context " + contextName);
        Configuration instance = ConfigurationFactory.getInstance().getConfiguration(contextName, configLocation);
        setConfiguration(instance);
        /*instance.start();
        Configuration old = setConfiguration(instance);
        updateLoggers();
        if (old != null) {
View Full Code Here

     * Cause a reconfiguration to take place when the underlying configuration file changes.
     * @param reconfigurable The Configuration that can be reconfigured.
     */
    public synchronized void onChange(Reconfigurable reconfigurable) {
        logger.debug("Reconfiguration started for context " + contextName);
        Configuration config = reconfigurable.reconfigure();
        if (config != null) {
            setConfiguration(config);
            logger.debug("Reconfiguration completed");
        } else {
            logger.debug("Reconfiguration failed");
View Full Code Here

    @BeforeClass
    public static void setupClass() {
        deleteDir();
        System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
        LoggerContext ctx = (LoggerContext) LogManager.getContext();
        Configuration config = ctx.getConfiguration();
    }
View Full Code Here

    @BeforeClass
    public static void setupClass() {
        deleteDir();
        System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
        LoggerContext ctx = (LoggerContext) LogManager.getContext();
        Configuration config = ctx.getConfiguration();
    }
View Full Code Here

        Log4jContextListener listener = new Log4jContextListener();
        ServletContextEvent event = new ServletContextEvent(context);
        listener.contextInitialized(event);
        Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
        LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
        Configuration config = ctx.getConfiguration();
        assertNotNull("No configuration", config);
        assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + " but found " + config.getName(),
            CONFIG_NAME.equals(config.getName()));
        Map<String, Appender> map = config.getAppenders();
        assertNotNull("No Appenders", map != null && map.size() > 0);
        assertTrue("Wrong configuration", map.containsKey("List"));
        listener.contextDestroyed(event);
        config = ctx.getConfiguration();
        assertTrue("Incorrect Configuration. Expected " + DefaultConfiguration.DEFAULT_NAME + " but found " +
            config.getName(), DefaultConfiguration.DEFAULT_NAME.equals(config.getName()));
    }
View Full Code Here

        Log4jContextListener listener = new Log4jContextListener();
        ServletContextEvent event = new ServletContextEvent(context);
        listener.contextInitialized(event);
        Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
        LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
        Configuration config = ctx.getConfiguration();
        assertNotNull("No configuration", config);
        assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + " but found " + config.getName(),
            CONFIG_NAME.equals(config.getName()));
        Map<String, Appender> map = config.getAppenders();
        assertNotNull("No Appenders", map != null && map.size() > 0);
        assertTrue("Wrong configuration", map.containsKey("List"));
        listener.contextDestroyed(event);
        config = ctx.getConfiguration();
        assertTrue("Incorrect Configuration. Expected " + DefaultConfiguration.DEFAULT_NAME + " but found " +
            config.getName(), DefaultConfiguration.DEFAULT_NAME.equals(config.getName()));
    }
View Full Code Here

TOP

Related Classes of org.apache.logging.log4j.core.config.Configuration

Copyright © 2018 www.massapicom. 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.