[ 
https://issues.apache.org/jira/browse/LOG4J2-1381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15820397#comment-15820397
 ] 

Travis Spencer commented on LOG4J2-1381:
----------------------------------------

While this area of the documentation is being updated, it would be _very_ 
helpful if it were pointed out that the rewrite policy _is_ an appender and 
needs to be added to a logger like any other appender. Perhaps that's obvious 
but it took a while to figure out. WIth the {{AppenderRef}} in the {{Rewrite}} 
element, one may think that the rewriting is enabled by that. It's not though. 
My suggestion is to:

1. At the beginning of the {{RewritePolicy}} section, add text such as: 

{quote}
A {{RewritePolicy}} should be defined after the appender that it will rewrite 
(as indicated by the {{AppenderRef}} child element). To use the 
{{RewritePolicy}}, a logger should reference the policy like any other appender 
(i.e., using an {{AppenderRef}} with the {{name}} given to the 
{{RewritePolicy}}). See the sample configuration below for examples of both the 
order in which things must be defined as well as how the {{RewritePolicy}} 
should be referenced by a logger.
{quote}

2. Add an XML comment next to the sample configs like this:

{code:xml}
  <Loggers>
    <Root level="error">
      <AppenderRef ref="Rewrite"/> <!-- Use the Rewrite appender not STDOUT -->
    </Root>
  </Loggers>
{code}


> Documentation for LoggerNameLevelRewritePolicy is wrong
> -------------------------------------------------------
>
>                 Key: LOG4J2-1381
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1381
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 2.5
>            Reporter: Remko Popma
>             Fix For: 2.8
>
>
> The docs for [LoggerNameLevelRewritePolicy 
> |http://logging.apache.org/log4j/2.x/manual/appenders.html#RewriteAppender] 
> are wrong:
> * property {{loggerName}} (both in the parameter table and in the example 
> configuration): looking at the code, this should be {{logger}} instead.
> * property {{LevelPair}} (in the parameter table) should be {{KeyValuePair}} 
> instead. The example configuration is correct here.
>  (Or should the code be modified to match the docs instead?)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to