Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Won't Fix
-
None
-
None
-
None
Description
Borrowing the general Groovy syntax used in Stapler, 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:
<?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>
This would look like this in the declarative Groovy DSL:
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') } } }
While it is not the goal of this particular feature to enable scripted configuration, it does open the possibility for such.
Attachments
Issue Links
- is related to
-
LOG4J2-1531 Change attribute and component values from String to Object
- Open
- links to