[logback-user] Groovy Configuration
Ceki Gülcü
ceki at qos.ch
Wed Jun 30 15:16:50 CEST 2010
Hi Lance,
If your config file is called logback.groovy, logback will
automatically pick it up. To programmatically invoke a groovy config
file, you would need to work with "GafferConfigurator" as Joran only
deals with XML files, not Groovy. You would write:
import ch.qos.logback.classic.gaffer.GafferConfigurator;
import ch.qos.logback.classic.LoggerContext;
...
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
GafferConfigurator gafferConfigurator = new GafferConfigurator(lc);
gafferConfigurator.run(configFile);
Let us know if the above works,
On 30/06/2010 3:06 PM, Lance White wrote:
> Hi,
>
> I’m having a play with the Groovy Configuration (in 0.9.23), but can’t
> see how you’re supposed to tell your program to use the Groovy
> configuration file. In normal circumstances, I’d use Joran to load a
> given XML file, but can’t see what the equivalent would be for Groovy.
>
> I tried just executing the Groovy script (using the Java 1.6 script
> engine system) but just get a groovy.lang.MissingMethodException when it
> tries to execute the appender line (I’m using the first example script
> on the Groovy Configuration page).
>
> Am I missing something obvious here?
>
> The Groovy version is 1.7.1.
>
> Cheers
>
> Lance
More information about the Logback-user
mailing list