Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1180

setting logback.debug property with groovy config throws exceptions when getting loggers

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.1.6, 1.1.7
    • I'm testing in clojure on OSX, Java 1.8, but the problem should affect any JVM language as long as you use groovy configuration

    Description

      If I set "-Dlogback.debug=true" in my JVM properties, set up a minimal logback.groovy config, and then call org.slf4j.LoggerFactory.getLogger("foo") I get the stack trace below.

      The root cause seems to be that GafferConfigurator.groovy calls "OnConsoleStatusListener.addNewInstanceToContext():
      https://github.com/qos-ch/logback/blob/master/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/GafferConfigurator.groovy#L65

      Whereas the current OnConsoleStatusListener has no such method, since this change:
      https://github.com/qos-ch/logback/commit/43877e7aa1bba269488682c5925389d37a2102cd

      I tried reverting to logback 1.1.5 and the debug flag works fine in that release with groovy config files.

      Full stack trace is:

      groovy.lang.MissingMethodException: No signature of method: static ch.qos.logback.core.status.OnConsoleStatusListener.addNewInstanceToContext() is applicable for argument types: (ch.qos.logback.classic.LoggerContext) values: [ch.qos.logback.classic.LoggerContext[default]]
      	at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1500)
      	at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1486)
      	at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:53)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
      	at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:65)
      	at ch.qos.logback.classic.gaffer.GafferConfigurator$run.callCurrent(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
      	at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:44)
      	at ch.qos.logback.classic.gaffer.GafferUtil.runGafferConfiguratorOn(GafferUtil.java:43)
      	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:67)
      	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
      	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
      	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
      	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:149)
      	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
      	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:390)
      	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:340)
      

      Attachments

        Activity

          People

            logback-dev Logback dev list
            korny@sietsma.com Kornelis Sietsma
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: