[logback-dev] [discuss] a new (prototypal) approach to Joran configuration
Simone Tripodi
simone.tripodi at gmail.com
Thu Jun 20 09:44:30 CEST 2013
Hi Ceki/all!
due to my recent involvement in Modello[1], I started experimenting
how the Modello approach could benefit existing projects that require
to parse XML (but also JSON and YAML) configurations, and took Logback
as a good example where doing some experiments...
What made me curious to made that experiment, is the fact that current
Joran approach is based to SAX APIs + reflection - elements are
introspected at runtime and components will be injected - while the
Modello approach is based on streaming APIs and introspection analysis
is performed at compile-time, generating the "parse-tree" and the
(un)marshallers.
So, I pushed an initial/prototypal logback-joran2 module in my
personal fork[2], which APIs are not integrated with the rest of the
project yet.
Configuration elements are defined in the Modello descriptor[3] which
enable the generation of Java APIs (included inner Builders/static
utility methods), the XML Reader/Writer (based on StAX APIs) and the
XSD that users could integrate in their preferred XML IDE in order to
enable the validation and auto-complete editing.
With that approach, users can create their configurations
programmatically, for free.
Final format is a little different to the current one, have a look to
a sample[4] generated via these APIs, but I am working to keep the
original format as much as I can.
Have a look also at how simple would be reading and writing configurations.
WDYT?
I already applied the Logback license header, in case you are
interested on exploring the Modello approach a little more and want me
to push request.
Have a nice day, all the best,
-Simo
[1] http://modello.codehaus.org/index.html
[2] https://github.com/simonetripodi/logback
[3] https://github.com/simonetripodi/logback/blob/master/logback-joran2/src/main/mdo/joran.mdo
[4] https://github.com/simonetripodi/logback/blob/master/logback-joran2/src/test/resources/ch/qos/logback/core/joran/v2/logback.xml
[5] https://github.com/simonetripodi/logback/blob/master/logback-joran2/src/test/java/ch/qos/logback/core/joran/v2/ConfigurationTestCase.java
http://people.apache.org/~simonetripodi/
http://www.99soft.org/
More information about the logback-dev
mailing list