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

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


            coreLogger.setAdditive(additive);

            LoggerContext context = coreLogger.getContext();

            BaseConfiguration configuration
                = (BaseConfiguration) context.getConfiguration();

            configuration.addAppender(appender);
            //this line sort of resets the loggers
//            context.updateLoggers(configuration);

//            if (coreLogger.getParent() == null) {
                for (LoggerConfig loggerConfig : configuration.getLoggers().values()) {
                    loggerConfig.addAppender(appender, level, filter);
//                }
            }
        } catch (Exception e) {
            throw Exceptions.runtime(e);
View Full Code Here


        coreLogger.setLevel(level);

        LoggerContext context = coreLogger.getContext();

        BaseConfiguration configuration = updateLevel(context, loggerName, level);

        List<ConfigurationListener> listeners = (List<ConfigurationListener>) OpenBean.getFieldValue(configuration, "listeners");

        for (ConfigurationListener listener : listeners) {
            updateLevel((LoggerContext) listener, loggerName, level);
View Full Code Here

            updateLevel((LoggerContext) listener, loggerName, level);
        }
    }

    private static BaseConfiguration updateLevel(LoggerContext context, String loggerName, Level level) {
        BaseConfiguration configuration = (BaseConfiguration) context.getConfiguration();

        for (LoggerConfig loggerConfig : configuration.getLoggers().values()) {
            if(loggerConfig.getName().startsWith(loggerName)){
                loggerConfig.setLevel(level);
            }
        }
View Full Code Here

TOP

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

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.