[
https://issues.apache.org/jira/browse/LOG4J2-589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14148572#comment-14148572
]
Remko Popma commented on LOG4J2-589:
------------------------------------
I have a question: currently I am putting the <CustomLevel> elements directly
in the <Configuration> element. Would it be better to enclose them in a
<CustomLevels> element?
That would look something like this:
{code}
<Configuration status="trace">
<!-- enclose custom level elements in a CustomLevels element? -->
<CustomLevels>
<CustomLevel name="DIAG" intLevel="350" />
<CustomLevel name="NOTICE" intLevel="450" />
<CustomLevel name="VERBOSE" intLevel="550" />
</CustomLevels>
...
{code}
Looking at the plugin code for <Loggers> and <Appenders> the function of the
"outer element plugins" seems to be to pass the LoggerConfig and Appender
objects to the Configuration object. In the case of Levels, we just make sure
the custom level is _defined_ by calling Level.forName(), but we can discard
the result.
Is there any other good argument to nest them in a "holder" element?
> Allow filtering on 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
> Assignee: Remko Popma
> Labels: configuration, custom, level
> Fix For: 2.1
>
>
> 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]