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

%cn conversion word fails in SMTPAppender subject

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.0.11
    • 0.9.26
    • logback-classic
    • None

    Description

      According to the docs, the subject pattern equals to the pattern layout. Putting a %cn into it fails with an exception

      <Subject>${HOSTNAME} %cn %level %X{ad.displayName} %logger{20} - %.20msg - %ex{-1}</Subject>
      
      15:13:56,973 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SMTPAppender]
      15:13:57,045 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [EMAIL]
      15:13:57,525 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@1a54421 - Failed to instantiate converter class [ch.qos.logback.classic.joran.action.ContextNameAction] ch.qos.logback.core.util.IncompatibleClassException
              at ch.qos.logback.core.util.IncompatibleClassException
              at      at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:47)
              at      at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:31)
              at      at ch.qos.logback.core.pattern.parser.Compiler.createConverter(Compiler.java:101)
              at      at ch.qos.logback.core.pattern.parser.Compiler.compile(Compiler.java:58)
              at      at ch.qos.logback.core.pattern.parser.Parser.compile(Parser.java:66)
              at      at ch.qos.logback.core.pattern.PatternLayoutBase.start(PatternLayoutBase.java:84)
              at      at ch.qos.logback.classic.net.SMTPAppender.makeSubjectLayout(SMTPAppender.java:101)
              at      at ch.qos.logback.core.net.SMTPAppenderBase.start(SMTPAppenderBase.java:155)
              at      at ch.qos.logback.classic.net.SMTPAppender.start(SMTPAppender.java:60)
              at      at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:96)
              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.siemens.ad.ld.listener.DataSourceService.<clinit>(DataSourceService.java:37)
              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:359)
              at      at java.lang.Class.newInstance(Class.java:312)
              at      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4079)
              at      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
              at      at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3391)
              at      at org.apache.catalina.manager.ManagerServlet.reload(ManagerServlet.java:943)
              at      at org.apache.catalina.manager.HTMLManagerServlet.reload(HTMLManagerServlet.java:556)
              at      at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:121)
              at      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
              at      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              at      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
              at      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
              at      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
              at      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
              at      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
              at      at java.lang.Thread.run(Thread.java:619)
      15:13:57,525 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@1a54421 - [cn] is not a valid conversion word
      15:13:57,532 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
      

      %contextName does work. This is a bug

      Attachments

        Activity

          People

            logback-dev Logback dev list
            michael-o Michael Osipov
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: