You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2017/08/16 12:12:01 UTC
[jira] [Commented] (LOG4J2-2018) LoggerNameLevelRewritePolicy
documentation is wrong, example is broken
[ https://issues.apache.org/jira/browse/LOG4J2-2018?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128686#comment-16128686 ]
ASF subversion and git services commented on LOG4J2-2018:
---------------------------------------------------------
Commit 8777af527862596b0adeaf148896d1085e69d191 in logging-log4j2's branch refs/heads/master from rpopma
[ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=8777af5 ]
LOG4J2-2018 Fix incorrect documentation for LoggerNameLevelRewritePolicy
> LoggerNameLevelRewritePolicy documentation is wrong, example is broken
> ----------------------------------------------------------------------
>
> Key: LOG4J2-2018
> URL: https://issues.apache.org/jira/browse/LOG4J2-2018
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders, Documentation
> Affects Versions: 2.8.2
> Reporter: Remko Popma
> Assignee: Remko Popma
> Fix For: 2.9
>
>
> The documentation on the [LoggerNameLevelRewritePolicy|http://logging.apache.org/log4j/2.x/manual/appenders.html#RewriteAppender] is wrong:
> Following the example in the documentation gives an error.
> {code}
> <LoggerNameLevelRewritePolicy loggerName="com.foo.bar">
> <KeyValuePair key="INFO" value="DEBUG"/>
> <KeyValuePair key="WARN" value="INFO"/>
> </LoggerNameLevelRewritePolicy>
> {code}
> The {{loggerName}} does not exist, resulting in this error:
> *{color:red}2017-08-16 13:46:13,712 main ERROR LoggerNameLevelRewritePolicy contains an invalid element or attribute "loggerName"
> {color}*
> The implementation looks like this, it appears that the configuration should use {{logger}} instead:
> {code}
> @PluginFactory
> public static LoggerNameLevelRewritePolicy createPolicy(
> // @formatter:off
> @PluginAttribute("logger") final String loggerNamePrefix,
> @PluginElement("KeyValuePair") final KeyValuePair[] levelPairs) {
> ...
> {code}
> I think {{loggerName}} is a more descriptive name for the attribute, but users may already be using {{logger}} after checking the implementation.
> Can we give this attribute an alias so that both {{loggerName}} and {{logger}} work? That way we can keep the current (descriptive) documentation and avoid breaking users existing configuration.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)