[
https://issues.apache.org/jira/browse/LOG4J2-589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14148662#comment-14148662
]
Remko Popma commented on LOG4J2-589:
------------------------------------
My intention was to just instantiate/define the Levels during configuration
processing. The CustomLevelPlugin objects are currently transient and are
discarded when config processing completes. I did not consider the need for
storing this information in the Configuration object, because users can use
{{Level.values()}} to obtain both the standard and the custom levels.
Should I add a getCustomLevels() method to Configuration? If so, please confirm
the semantics:
This would only return the custom levels defined in the current configuration.
So this does _not_ include custom levels that are defined in code with direct
calls to {{Level.forName}}. If custom levels are removed from the config file,
reconfiguration will result in a Configuration with _only_ the levels in the
current configuration - even though the previously defined Level objects are
_not_ removed. Finally, if we provide a setCustomLevels() method, should that
method call {{Level.forName}}?
I did try a JSON configuration, both with and without a container element, and
for some reason only the last "CustomLevel" element results in the
{{CustomLevelPlugin.createLevel()}} factory method being invoked... No idea why
yet.
> 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]