I've seen the commit. I will check it out.

Offtopic: fixed a typo in the javadoc:


diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
index 3c8c44a..14ea97b 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
@@ -66,7 +66,7 @@ import org.apache.logging.log4j.util.Strings;
  * </ol>
  *
  * If the ConfigurationFactory that was added returns null on a call to
- * getConfiguration the any other ConfigurationFactories found as plugins will + * getConfiguration then any other ConfigurationFactories found as plugins will
  * be called in their respective order. DefaultConfiguration is always called
  * last if no configuration has been returned.
  */


"I will check it out." Now isn't that ambiguous :P.

Regards..



Quoting Gary Gregory <[email protected]>:

Pushed to Git master.

Xen: Please see the setLevel methods in Configurator.

Gary

On Sat, Aug 8, 2015 at 4:24 PM, Gary Gregory <[email protected]> wrote:

Please see the patch in https://issues.apache.org/jira/browse/LOG4J2-1090

Gary

On Sat, Aug 8, 2015 at 4:05 PM, Ralph Goers <[email protected]>
wrote:

Yes.

Ralph

> On Aug 8, 2015, at 4:03 PM, Gary Gregory <[email protected]>
wrote:
>
> That's my bad, I misread Configurator for Configuration.
>
> That said, the
> method
org.apache.logging.log4j.core.config.AbstractConfiguration.getRootLogger()
> is not in the Configuration interface. Is it OK to add it?
>
> Gary
>
> On Sat, Aug 8, 2015 at 3:42 PM, Ralph Goers <[email protected]
>
> wrote:
>
>> I just noticed you added this to AbstractConfiguration. Wouldn’t it be
>> easier for users to do it as a method on Configurator?
>>
>> Ralph
>>
>>> On Aug 8, 2015, at 12:55 PM, Gary Gregory <[email protected]>
>> wrote:
>>>
>>> setLevel, setRootLevel; code review please, note the added check " if
>>> (!loggerConfig.getLevel().equals(level)) ..."
>>>
>>> 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..7ee09ca 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;
>>> @@ -829,4 +830,23 @@
>>>        return buffer.toByteArray();
>>>    }
>>>
>>> +    @Override
>>> +    public void setLevel(final String loggerName, final Level level)
{
>>> +        setLevel(getLoggerConfig(loggerName), level);
>>> +    }
>>> +
>>> +    @Override
>>> +    public void setRootLevel(final Level level) {
>>> +        setLevel(getRootLogger(), level);
>>> +    }
>>> +
>>> +    private void setLevel(final LoggerConfig loggerConfig, final
Level
>>> level) {
>>> +        if (!loggerConfig.getLevel().equals(level)) {
>>> +            loggerConfig.setLevel(level);
>>> +            final LoggerContext loggerContext = (LoggerContext)
>>> LogManager.getContext(false);
>>> +            loggerContext.updateLoggers();
>>> +        }
>>> +    }
>>> +
>>> +
>>> }
>>> diff --git
>>>
>>
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configuration.java
>>>
>>
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configuration.java
>>> index c592b05..29fb7b2 100644
>>> ---
>>>
>>
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configuration.java
>>> +++
>>>
>>
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configuration.java
>>> @@ -137,4 +137,18 @@
>>>     * @return the custom levels defined in the current configuration
>>>     */
>>>    List<CustomLevelConfig> getCustomLevels();
>>> +
>>> +    /**
>>> +     * Sets the level of the given logger name.
>>> +     *
>>> +     * @param loggerName the logger name
>>> +     * @param level the new level
>>> +     */
>>> +    void setLevel(String loggerName, Level level);
>>> +
>>> +    /**
>>> +     * Sets the level of the root logger.
>>> +     * @param level the new level
>>> +     */
>>> +    void setRootLevel(Level level);
>>> }
>>>
>>> Gary
>>>
>>> On Sat, Aug 8, 2015 at 11:14 AM, Ralph Goers <
[email protected]
>>>
>>> wrote:
>>>
>>>> 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]
>>>>
>>>>
>>>
>>>
>>> --
>>> 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]
>>
>>
>
>
> --
> 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]




--
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




--
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