[
https://issues.apache.org/jira/browse/LOG4J2-589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14146526#comment-14146526
]
Remko Popma edited comment on LOG4J2-589 at 9/24/14 4:57 PM:
-------------------------------------------------------------
I see.
I think it may have to do with this test class:
{code}
package org.apache.logging.log4j.test;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.plugins.Plugin;
@Plugin(name="ExtendedLevel", category="Level")
public class ExtendedLevels {
public static final Level NOTE = Level.forName("NOTE", 350);
public static final Level DETAIL = Level.forName("DETAIL", 450);
}
{code}
Just doing a {{Class.forName("org.apache.logging.log4j.test.ExtendedLevels")}}
would create these custom levels in memory. So a configuration that contains an
{{<ExtendedLevel />}} element would create the DIAG and NOTICE levels. Would
that be it?
If that was the intention I think it would be more user-friendly if users can
just do this in configuration without having to write any java code:
{code}
<Configuration status="warn">
<CustomLevel name="DIAG" intLevel="350" />
<CustomLevel name="NOTICE" intLevel="450" />
...
{code}
was (Author: [email protected]):
I see. That was the early days of custom levels...
I think it may have to do with this test class:
{code}
package org.apache.logging.log4j.test;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.plugins.Plugin;
@Plugin(name="ExtendedLevel", category="Level")
public class ExtendedLevels {
public static final Level NOTE = Level.forName("NOTE", 350);
public static final Level DETAIL = Level.forName("DETAIL", 450);
}
{code}
Just doing a {{Class.forName("org.apache.logging.log4j.test.ExtendedLevels")}}
would create these custom levels in memory. Would that be it?
If that was the intention I think it would be more user-friendly if users can
just do this in configuration without having to write any java code:
{code}
<Configuration status="warn">
<CustomLevel name="DIAG" intLevel="350" />
<CustomLevel name="NOTICE" intLevel="450" />
...
{code}
> Allow the use of custom levels in configuration
> -----------------------------------------------
>
> Key: LOG4J2-589
> URL: https://issues.apache.org/jira/browse/LOG4J2-589
> Project: Log4j 2
> Issue Type: Improvement
> Components: Configurators
> Affects Versions: 2.0-rc1
> Reporter: James Hutton
> Labels: configuration, custom, level
> Fix For: 2.2
>
>
> Previous title: Use forName instead of getLevel and valueOf for configuration
> Without this one cannot use custom log levels in configuration without
> forking a large amount of code. Either the forName method needs to be
> removed and custom log levels should be explicitly forbidden, or support
> should be consistent.
> Classes that would need to be modified:
> BaseConfiguration, NullConfiguration, and DefaultConfiguration.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]