[ https://issues.apache.org/jira/browse/LOG4J2-1686?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15662562#comment-15662562 ]
Raman Gupta commented on LOG4J2-1686: ------------------------------------- Couple last thoughts: I see scripts and conditional configuration as orthogonal concerns. Right now, scripts cover some element of conditionality (PatternMatch), but that shouldn't be their primary use case. Their primary use case I think is given more in the filter example -- where the script in essence is a way to define a simple filter inline in the configuration without writing a full custom class for the filter. Conditional configuration is not well served by scripting as I am guessing it is currently implemented, because the existing configuration elements are perfectly sufficient -- and more than sufficient, desirable -- to express what the user wants. The only thing missing is a way to have a mechanism to choose between them. Now, if we can define a simple way to achieve this via scripts, so much the better. One thought would be to allow *any* element to have `key` and `keyScript` attributes, which would be used to "filter" the elements that apply to the current config e.g. I think would modify it to work something like this: {code:xml} <Scripts> <Script name="selector" language="javascript"><![CDATA[ // return key ]]></Script> </Scripts> <Appenders> <Console ...> <PatternLayout key="key1" keyScript="selector" pattern="%m%n"/> <PatternLayout key="key2" keyScript="selector" pattern="[%-5level] %c{1.} %msg%n""/> <PatternLayout keyScriptDefault="true" keyScript="selector" pattern="..."/> </Console> </Appenders> {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