Yup.

And while your at it you might want to add setRootLevel(Level level);

Ralph

> On Aug 8, 2015, at 10:19 AM, Gary Gregory <[email protected]> wrote:
> 
> Like this:
> 
> diff --git
> a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
> index ada5900..bf01c3e 100644
> ---
> a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
> +++
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
> @@ -39,6 +39,7 @@
> import org.apache.logging.log4j.core.Filter;
> import org.apache.logging.log4j.core.Layout;
> import org.apache.logging.log4j.core.LogEvent;
> +import org.apache.logging.log4j.core.LoggerContext;
> import org.apache.logging.log4j.core.appender.AsyncAppender;
> import org.apache.logging.log4j.core.appender.ConsoleAppender;
> import org.apache.logging.log4j.core.async.AsyncLoggerConfig;
> @@ -788,6 +789,13 @@
>        return list;
>    }
> 
> +    public void setLevel(String loggerName, Level level) {
> +        LoggerConfig loggerConfig = getLoggerConfig(loggerName);
> +        loggerConfig.setLevel(level);
> +        final LoggerContext loggerContext = (LoggerContext)
> LogManager.getContext(false);
> +        loggerContext.updateLoggers();
> +    }
> +
>    private void setParents() {
>         for (final Map.Entry<String, LoggerConfig> entry :
> loggers.entrySet()) {
>            final LoggerConfig logger = entry.getValue();
> 
> ?
> 
> On Fri, Aug 7, 2015 at 5:43 AM, Ralph Goers <[email protected]>
> wrote:
> 
>> I'd recommend the Configurator class.
>> 
>> Ralph
>> 
>>> On Aug 6, 2015, at 9:46 PM, Gary Gregory <[email protected]> wrote:
>>> 
>>> 
>>> For the simple case where you want to update one level, I think we should
>>> have a one method call for folks. Where would be the best place to hang
>>> that?
>>> 
>>> Gary
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>> 
> 
> 
> -- 
> E-Mail: [email protected] | [email protected]
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to