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

An exception is thrown during the web application startup.

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • None
    • logback-core
    • None
    • Ubuntu 9.04

    Description

      Appender is configurated the next way:

      <appender name="appender class="ch.qos.logback.classic.net.SMTPAppender">
      <SMTPHost>some_host</SMTPHost>
      <BufferSize>10</BufferSize>
      <To>some@email.address</To>
      <From>som@email.address2</From>
      <Subject>Some subject</Subject>
      <layout class="ch.qos.logback.classic.html.HTMLLayout"/>
      <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
      <marker>Some Marker</marker>
      </evaluator>
      <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
      <evaluator name="MARKER">
      <expression>marker != null && event.getLevel().toInt() >= WARN</expression>
      </evaluator>
      <OnMatch>ACCEPT</OnMatch>
      <OnMismatch>DENY</OnMismatch>
      </filter>
      </appender>

      And when the web application is starting the following stacktrace can be observed:

      21:02:57,596 |-ERROR in ch.qos.logback.classic.boolex.JaninoEventEvaluator@1bde392 - Could not start evaluator with expression [marker != null && event.getLevel().toInt() >= WARN.toInt()] org.codehaus.janino.CompileException: Line 2, Column 57: A method named "toInt" is not declared in any enclosing class nor any supertype, nor through a static import
      at org.codehaus.janino.CompileException: Line 2, Column 57: A method named "toInt" is not declared in any enclosing class nor any supertype, nor through a static import
      at at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.access$51(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler$9.visitMethodInvocation(UnitCompiler.java)
      at at org.codehaus.janino.Java$MethodInvocation.accept(Java.java)
      at at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compileBoolean2(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.access$31(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler$7.visitBinaryOperation(UnitCompiler.java)
      at at org.codehaus.janino.Java$BinaryOperation.accept(Java.java)
      at at org.codehaus.janino.UnitCompiler.compileBoolean(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compileBoolean2(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.access$31(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler$7.visitBinaryOperation(UnitCompiler.java)
      at at org.codehaus.janino.Java$BinaryOperation.accept(Java.java)
      at at org.codehaus.janino.UnitCompiler.compileBoolean(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.access$44(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler$9.visitBinaryOperation(UnitCompiler.java)
      at at org.codehaus.janino.Java$BinaryOperation.accept(Java.java)
      at at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.access$17(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler$4.visitReturnStatement(UnitCompiler.java)
      at at org.codehaus.janino.Java$ReturnStatement.accept(Java.java)
      at at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.access$7(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler$4.visitBlock(UnitCompiler.java)
      at at org.codehaus.janino.Java$Block.accept(Java.java)
      at at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java)
      at at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java)
      at at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java)
      at at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java)
      at at org.codehaus.janino.SimpleCompiler.compileToClassLoader(SimpleCompiler.java)
      at at org.codehaus.janino.ClassBodyEvaluator.compileToClass(ClassBodyEvaluator.java)
      at at org.codehaus.janino.ScriptEvaluator.cook(ScriptEvaluator.java)
      at at org.codehaus.janino.ScriptEvaluator.cook(ScriptEvaluator.java)
      at at org.codehaus.janino.Cookable.cook(Cookable.java)
      at at org.codehaus.janino.Cookable.cook(Cookable.java)
      at at org.codehaus.janino.Cookable.cook(Cookable.java)
      at at org.codehaus.janino.ExpressionEvaluator.<init>(ExpressionEvaluator.java)
      at at ch.qos.logback.core.boolex.JaninoEventEvaluatorBase.start(JaninoEventEvaluatorBase.java:58)
      at at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:168)
      at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:315)
      at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:194)
      at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:180)
      at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:52)
      at at ch.qos.logback.core.joran.spi.Interpreter.play(Interpreter.java:332)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:126)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:93)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:52)
      at at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:77)
      at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
      at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
      at at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
      at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
      at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
      at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
      at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
      at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
      at at com.shc.obu.mp.sellpo.batch.ContextListener.<clinit>(ContextListener.java:13)
      at at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at at java.lang.Class.newInstance0(Class.java:355)
      at at java.lang.Class.newInstance(Class.java:308)
      at at org.mortbay.jetty.webapp.WebXmlConfiguration.newListenerInstance(WebXmlConfiguration.java:650)
      at at org.mortbay.jetty.webapp.WebXmlConfiguration.initListener(WebXmlConfiguration.java:631)
      at at org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(WebXmlConfiguration.java:368)
      at at org.mortbay.jetty.plus.webapp.AbstractConfiguration.initWebXmlElement(AbstractConfiguration.java:190)
      at at org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(WebXmlConfiguration.java:289)
      at at org.mortbay.jetty.plus.webapp.AbstractConfiguration.initialize(AbstractConfiguration.java:133)
      at at org.mortbay.jetty.webapp.WebXmlConfiguration.configure(WebXmlConfiguration.java:222)
      at at org.mortbay.jetty.plus.webapp.AbstractConfiguration.configure(AbstractConfiguration.java:113)
      at at org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(WebXmlConfiguration.java:180)
      at at org.mortbay.jetty.plus.webapp.AbstractConfiguration.configureWebApp(AbstractConfiguration.java:96)
      at at org.mortbay.jetty.plus.webapp.Configuration.configureWebApp(Configuration.java:149)
      at at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1247)
      at at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
      at at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
      at at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
      at at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
      at at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
      at at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
      at at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at at org.mortbay.jetty.Server.doStart(Server.java:224)
      at at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
      at at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441)
      at at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
      at at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
      at at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
      at at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      at at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      at at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
      at at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
      at at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      at at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      at at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      at at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      at at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      at at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      at at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      at at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at at java.lang.reflect.Method.invoke(Method.java:597)
      at at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      at at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at at java.lang.reflect.Method.invoke(Method.java:597)
      at at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)

      The only one right configuration without exceptions is:

      <appender name="appender class="ch.qos.logback.classic.net.SMTPAppender">
      <SMTPHost>some_host</SMTPHost>
      <BufferSize>10</BufferSize>
      <To>some@email.address</To>
      <From>som@email.address2</From>
      <Subject>Some subject</Subject>
      <layout class="ch.qos.logback.classic.html.HTMLLayout"/>
      <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
      <marker>Some Marker</marker>
      </evaluator>
      <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
      <evaluator name="MARKER">
      <expression>marker != null && event.getLevel().toInt() >= WARN</expression>
      </evaluator>
      <OnMatch>ACCEPT</OnMatch>
      <OnMismatch>DENY</OnMismatch>
      </filter>
      </appender>

      event.getLevel().toInt() >= WARN (not event.getLevel().toInt() >= WARN.toInt())

      But according to http://logback.qos.ch/manual/filters.html#evalutatorFilter we need to use event.getLevel().toInt() >= WARN.toInt().

      Attachments

        Activity

          People

            logback-dev Logback dev list
            pavel.mikhalchuk Pavel Mikhalchuk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: