Re: Access to current run-time config

2018-02-21 Thread Arnold Morein
I'll look into the JMX. I can forego the stopping/starting of an appender if there is a way to force a rotation. I also want to change the level of the appender or a given logger/loggers on the fly. On Feb 20, 2018, at 07:11 PM, Ralph Goers wrote: Stopping an appender that is in an ac

Re: Access to current run-time config

2018-02-20 Thread Ralph Goers
Stopping an appender that is in an active configuration is going to cause problems. You need to remove all references to that appender from LoggerConfigs (or “wrapper” appenders), call the updateLoggers method to have that take effect, then remove the appender from the configuration, and then

Re: Access to current run-time config

2018-02-20 Thread Arnold Morein
That was it! Thanks. Next question: When I do this:    LoggerContext loggerContext = (LoggerContext)LogManager.getContext(false);         Configuration loggerConfiguration = loggerContext.getConfiguration();         Map appendersType = loggerConfiguration.getAppenders();    for

Re: Access to current run-time config

2018-02-20 Thread Franz Wong
Do you mean something like this? public class MainApplication { public static void main(String[] args) throws Exception { Logger logger = LogManager.getLogger(MainApplication.class); // logging level is error logger.error("msg1"); logger.info("msg2"); org.apache.logging.log4j.core.LoggerCon

Access to current run-time config

2018-02-19 Thread Arnie Morein
Hello, looking for some advice, assuming this is possible. I am working with a rather complex application and the log4j2 configuration is also complex (12+ loggers). It is started at war deployment by a WEB-INF/classes/log4j2.xml file and then after the context is started, based on the host nam