[logback-dev] [discuss] a new (prototypal) approach to Joran configuration

ceki ceki at qos.ch
Thu Jun 20 23:13:55 CEST 2013


On 20.06.2013 09:44, Simone Tripodi wrote:
> 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.

Is there introspection support in Modello?

> 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.

That's just awesome!

> 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.

Are there any hooks in Modello to support setting component properties, 
e.g. appender properties? (It's a quasi-repeat of earlier question about 
introspection in Modello.)

> Have a look also at how simple would be reading and writing configurations.
>
> WDYT?

I think that Modello has some very interesting features which are
lacking in Joran. Had I known about Modello earlier, I would probably
have not written Joran in the first place.

> 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/


-- 
Ceki
65% of statistics are made up on the spot


More information about the logback-dev mailing list