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

Ralph Goers edited comment on LOG4J2-1686 at 11/14/16 5:42 PM:
---------------------------------------------------------------

Thanks for looking. You are correct that the doc is wrong.  I suspect that some 
of this was copied from the unit test and then modified but the modifications 
weren't tested.

The configuration in the unit test is:

{code}
<Configuration status="WARN" name="RoutingTest">
  <Appenders>
    <ScriptAppenderSelector name="SelectIt">
      <Script language="groovy"><![CDATA[
         return "OSNameFoo".contains("Foo") ? "List2": "List1";]]>
      </Script>
      <AppenderSet>
        <List name="List1" />
        <List name="List2" />
      </AppenderSet>
    </ScriptAppenderSelector>
  </Appenders>
  <Loggers>
    <Root level="error">
      <AppenderRef ref="SelectIt" />
    </Root>
  </Loggers>
</Configuration>
{code}

The appender reference does have to use the name on the AppenderSelector.


was (Author: ralph.go...@dslextreme.com):
Thanks for looking. You are correct that the doc is wrong.  I suspect that some 
of this was copied from the unit test and then modified but the modifications 
weren't tested.

The configuration in the unit test is:

{code}
<Configuration status="WARN" name="RoutingTest">
  <Appenders>
    <ScriptAppenderSelector name="SelectIt">
      <Script language="groovy"><![CDATA[
         return "OSNameFoo".contains("Foo") ? "List2": "List1";]]>
      </Script>
      <AppenderSet>
        <List name="List1" />
        <List name="List2" />
      </AppenderSet>
    </ScriptAppenderSelector>
  </Appenders>
  <Loggers>
    <Root level="error">
      <AppenderRef ref="SelectIt" />
    </Root>
  </Loggers>
</Configuration>
{code}

> Support conditional configuration
> ---------------------------------
>
>                 Key: LOG4J2-1686
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1686
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Configurators
>    Affects Versions: 2.7
>            Reporter: Raman Gupta
>            Priority: Blocker
>
> It would be great to support conditional configuration like logback:
> http://logback.qos.ch/manual/configuration.html#conditional
> This allows for more advanced configuration than is currently possible with 
> property substitution.
> Example use case: to implement 
> https://issues.apache.org/jira/browse/LOG4J2-1685 without log4j library 
> support.



--
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