[logback-user] Groovy Configuration

Ceki Gülcü ceki at qos.ch
Wed Jun 30 15:50:01 CEST 2010


The run method expects a URL, a File or the script itself (as a String). 
Try this:

gafferConfigurator.run(new File("c:/tmp/aaa.groovy"));


On 30/06/2010 3:43 PM, Lance White wrote:
> Afraid not...
>
> I seem to get a variety of errors depending on what the script file is...
>
> With a script file called 'aaa.groovy' in the current working directory (c:\tmp) :
>
> If I call gafferConfigurator.run("aaa.groovy"); or I call gafferConfigurator.run("c:/tmp/aaa.groovy"); then I get
>
> groovy.lang.MissingPropertyException: No such property: aaa for class: Script1
> 	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
> 	at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:241)
> 	at Script1.run(Script1.groovy:1)
> 	at Script1$run.call(Unknown Source)
> 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:121)
> 	at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:58)
> 	at test.test3.run(test3.java:32)
> 	at test.test3.main(test3.java:59)
>
> whereas if I call gafferConfigurator.run("c:\\tmp\\aaa.groovy"); I get
>
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> Script1.groovy: 1: unexpected char: '\' @ line 1, column 3.
>     C:\tmp\aaa.groovy
>       ^
>
> 1 error
>
> 	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)
> 	at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:143)
> 	at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:113)
> 	at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:125)
> 	at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:353)
> 	at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:99)
> 	at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:71)
> 	at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:249)
> 	at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:160)
> 	at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:845)
> 	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:521)
> 	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:497)
> 	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:474)
> 	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:292)
> 	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:727)
> 	at groovy.lang.GroovyShell.parse(GroovyShell.java:739)
> 	at groovy.lang.GroovyShell.parse(GroovyShell.java:766)
> 	at groovy.lang.GroovyShell.parse(GroovyShell.java:757)
> 	at groovy.lang.GroovyShell$parse.call(Unknown Source)
> 	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
> 	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
> 	at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:47)
> 	at test.test3.run(test3.java:34)
> 	at test.test3.main(test3.java:61)
>
> Cheers
>
> Lance
>


More information about the Logback-user mailing list