[logback-user] logback and gradle

Mihai Cazacu cazacugmihai at gmail.com
Mon Mar 11 10:35:47 CET 2013


Hi,

I need some help to integrate logback into my app.
I use gradle to automate the building and this error occurs when running
"gradlew runMod" task:

[configuration ':archives', configuration ':compile', configuration
> ':default', configuration ':groovy', configuration ':provided',
> configuration ':runtime', configuration ':signatures', configuration
> ':testCompile',configuration ':testRuntime']
> :cleanModsDir
> :clean
> BUILD SUCCESSFUL


> Total time: 5.028 secs
> Download
> https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-core/2.0.0-SNAPSHOT/vertx-core-2.0.0-20130311.090856-218.jar
> Download
> https://oss.sonatype.org/content/repositories/snapshots/io/vertx/vertx-platform/2.0.0-SNAPSHOT/vertx-platform-2.0.0-20130311.090922-217.jar
> [configuration ':archives', configuration ':compile', configuration
> ':default', configuration ':groovy', configuration ':provided',
> configuration ':runtime', configuration ':signatures', configuration
> ':testCompile', configuration ':testRuntime']
> Relying on packaging to define the extension of the main artifact has been
> deprecated and is scheduled to be removed in Gradle 2.0
> Download
> https://oss.sonatype.org/content/repositories/snapshots/io/vertx/lang-groovy/1.0.0-SNAPSHOT/lang-groovy-1.0.0-SNAPSHOT.zip
> :compileJava UP-TO-DATE
> :compileGroovy
> :processResources
> :classes
> :copyMod
> :runMod

println: before test.start
> SLF4J: Class path contains multiple SLF4J bindings.
> *SLF4J: Found binding in
> [jar:file:/c:/Users/mihai/Desktop/test/mods/mod-owner~mod-name~1.0.0-SNAPSHOT/lib/logback-classic-1.0.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in
> [jar:file:/C:/Users/mihai/.gradle/wrapper/dists/gradle-1.4-bin/47n6g3pbi5plc7n8fn58nkinje/gradle1.4/lib/logback-classic-1.0.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> *
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> explanation.
> Failed to instantiate [ch.qos.logback.classic.LoggerContext]
> Reported exception:
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> Script1.groovy: 1: unable to resolve class ch.qos.logback.classic.Level
>  @ line 1, column 1.
>    import ch.qos.logback.classic.Level
>    ^
> Script1.groovy: 5: unable to resolve class
> ch.qos.logback.core.rolling.TimeBasedRollingPolicy
>  @ line 5, column 1.
>    import ch.qos.logback.core.rolling.TimeBasedRollingPolicy
>    ^


> Script1.groovy: 4: unable to resolve class
> ch.qos.logback.core.rolling.RollingFileAppender
>  @ line 4, column 1.
>    import ch.qos.logback.core.rolling.RollingFileAppender
>    ^
> Script1.groovy: 3: unable to resolve class
> ch.qos.logback.core.ConsoleAppender
>  @ line 3, column 1.
>    import ch.qos.logback.core.ConsoleAppender
>    ^
> Script1.groovy: 6: unable to resolve class
> ch.qos.logback.core.status.OnConsoleStatusListener
>  @ line 6, column 1.
>    import ch.qos.logback.core.status.OnConsoleStatusListener
>    ^


> Script1.groovy: 2: unable to resolve class
> ch.qos.logback.classic.encoder.PatternLayoutEncoder
>  @ line 2, column 1.
>    import ch.qos.logback.classic.encoder.PatternLayoutEncoder
>    ^
> Script1.groovy: 8: unable to resolve class ch.qos.logback.classic.Level
>  @ line 8, column 1.
>    import static ch.qos.logback.classic.Level.INFO
>    ^
> Script1.groovy: 9: unable to resolve class ch.qos.logback.classic.Level
>  @ line 9, column 1.
>    import static ch.qos.logback.classic.Level.WARN
>    ^
> 8 errors


        at
> org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:309)
>         at
> org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:927)
>         at
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:575)
>         at
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:524)
>         at
> groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279)
>         at
> groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258)
>         at groovy.lang.GroovyShell.parseClass(GroovyShell.java:613)
>         at groovy.lang.GroovyShell.parse(GroovyShell.java:625)
>         at groovy.lang.GroovyShell.parse(GroovyShell.java:652)
>         at groovy.lang.GroovyShell.parse(GroovyShell.java:643)
>         at groovy.lang.GroovyShell$parse.call(Unknown Source)
>         at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>         at
> ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:48)
>         at
> ch.qos.logback.classic.gaffer.GafferConfigurator$run.callCurrent(Unknown
> Source)
>         at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
>         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
>         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
>         at
> ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:37)
>         at
> ch.qos.logback.classic.gaffer.GafferUtil.runGafferConfiguratorOn(GafferUtil.java:43)
>         at
> ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:65)
>         at
> ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
>         at
> org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
>         at
> org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
>         at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
>         at
> org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
>         at
> org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
>         at test.Test.start(Test.groovy:20)
>         at org.vertx.groovy.platform.Verticle.start(Verticle.groovy:35)
>         at org.vertx.groovy.platform.Verticle$start.call(Unknown Source)
>         at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>         at
> org.vertx.groovy.platform.impl.GroovyVerticle.start(GroovyVerticle.groovy:59)
>         at
> org.vertx.java.platform.impl.DefaultPlatformManager$11.run(DefaultPlatformManager.java:1171)
>         at org.vertx.java.core.impl.Context$1.run(Context.java:127)
>         at
> org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:366)
>         at
> org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:290)
>         at
> org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
>         at
> org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
>         at
> org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
>         at
> org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>         at java.lang.Thread.run(Thread.java:722)

SLF4J: Actual binding is of type
> [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
> 11:27:25,808 |-INFO in ch.qos.logback.classic.LoggerContext[default] -
> Found resource [logback.groovy] at
> [file:/c:/Users/mihai/Desktop/test/mods/mod-owner~mod-name~1.0.0-SNAPSHOT/logback.groovy]


> println: after test.start
> CTRL-C to stop server
> > Building > :runMod


The sample app can be found in the attachment. Just unpack and run "gradlew
runMod".

Thanks,
Mihai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130311/69a9f6f4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.7z
Type: application/octet-stream
Size: 50235 bytes
Desc: not available
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130311/69a9f6f4/attachment-0001.obj>


More information about the Logback-user mailing list