[ https://issues.apache.org/jira/browse/LOG4J2-2600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16867024#comment-16867024 ]
Matt Sicker commented on LOG4J2-2600: ------------------------------------- Yes, I believe I did come across this issue. My current workaround was to apply toString() on the values since they'll get re-converted by TypeConverters later when the Node itself is parsed. Due to the multiple layers of ASTs going on here (as well as a bug in my proof of concept), I sort of fizzled out for the moment until I reconsider what to do there in general. There's a very prime opportunity to do something with the plugin system and configuration system and create a more proper DI-type container and AST transformer. If I write a configuration in a type safe language like Java or something instead of a stringy one like XML, I'd like to preserve that type information or avoid unnecessary type conversions when the resulting destination of that configuration value is not a string type. This is useful for any file types besides XML and properties that tend to define more data types explicitly. > 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 > Assignee: Matt Sicker > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > 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)