[ https://issues.apache.org/jira/browse/LOG4J2-2600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16849102#comment-16849102 ]
Matt Sicker commented on LOG4J2-2600: ------------------------------------- So far, what my experimentation has found is that this can likely be generically handled by recursively constructing {{Component}} instances until the root component where its attributes will need to be checked manually for the attributes set on {{configuration}} as those are currently handled specially (or should I say, statically). I've also been able to adopt the Groovy method argument parsing algorithm used in JellyBuilder as linked in the Stapler classes, so supporting the same syntax there seems to be relatively simple. > Declarative Groovy Configuration DSL > ------------------------------------ > > Key: LOG4J2-2600 > URL: https://issues.apache.org/jira/browse/LOG4J2-2600 > Project: Log4j 2 > Issue Type: New Feature > Components: Configurators > Reporter: Matt Sicker > Priority: Major > > Borrowing the general Groovy syntax used in > [Stapler|https://github.com/stapler/stapler/tree/master/groovy/src/main/java/org/kohsuke/stapler/jelly/groovy], > a declarative Groovy syntax comparable to the existing XML/JSON/YAML syntax > tree for writing configuration files. > For example, a minimal binding implementation might look something like this. > Starting with an example XML configuration: > {code:xml} > <?xml version="1.0" encoding="UTF-8"?> > <Configuration status="WARN"> > <Appenders> > <Console name="Console" target="SYSTEM_OUT"> > <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - > %msg%n"/> > </Console> > </Appenders> > <Loggers> > <Logger name="com.foo.Bar" level="trace"> > <AppenderRef ref="Console"/> > </Logger> > <Root level="error"> > <AppenderRef ref="Console"/> > </Root> > </Loggers> > </Configuration> > {code} > This would look like this in the declarative Groovy DSL: > {code:groovy} > configuration(status: 'warn') { > appenders { > console(name: 'Console', target: 'SYSTEM_OUT') { > patternLayout(pattern: '%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - > %msg%n') > } > } > loggers { > logger(name: 'com.foo.Bar', level: 'trace') { > appenderRef(ref: 'Console') > } > root(level: 'error') { > appenderRef(ref: 'Console') > } > } > } > {code} > While it is not the goal of this particular feature to enable scripted > configuration, it does open the possibility for such. -- This message was sent by Atlassian JIRA (v7.6.3#76005)