[logback-user] Programmatic configuration

Kristoffer Sjögren stoffe at gmail.com
Wed Sep 4 13:00:48 CEST 2013


Or better yet, extract ContextInitializer.autoConfig to an SPI interface
that will fallback to ContextInitializer if no provider is found on
classpath. Maybe even have a system property that force a specific
implementation, if multiple ones are found.



On Wed, Sep 4, 2013 at 8:29 AM, Kristoffer Sjögren <stoffe at gmail.com> wrote:

> Hi
>
> I would like to handle logback configuration programmatically - without
> files (XML, Groovy, etc).
>
> My problem is that I cant find an obvious way to override the fallback
> behavior in ContextInitializer.autoConfig, which ultimately result that a
> ConsoleAppender is created by BasicConfigurator (since no URL was found for
> Joran).
>
> It would be nice to if BasicConfigurator could be replaced for something
> else, maybe using
> http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html or
> something similar.
>
> Maybe adding an modified copy of BasicConfigurator (but with same fully
> qualified classname) first on classpath would be possible? But this feels
> more like a hack.
>
> Cheers,
> -Kristoffer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130904/cfb0150e/attachment.html>


More information about the Logback-user mailing list