[logback-dev] [discuss] a new (prototypal) approach to Joran configuration
Simone Tripodi
simonetripodi at apache.org
Fri Jun 21 10:20:59 CEST 2013
Hi Ceki!
On Thu, Jun 20, 2013 at 11:13 PM, ceki <ceki at qos.ch> wrote:
> 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?
>
Nope, unfortunately :( it generates readers/writers that just invoke
plain old setters/getters/adders for generated models, but that is why
maybe is efficient.
>
>> 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.
>
may I can kindly ask you to point me to the current XML schema for
Joran configuration? Once complete, I think you could evaluate an
experimental Joran2 module - which can co-live nicely with existing
Joran...
All the best,
-Simo
http://people.apache.org/~simonetripodi/
http://twitter.com/simonetripodi
More information about the logback-dev
mailing list