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

HOSTNAME property not resolved

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • None
    • 0.9.26
    • None
    • None

    Description

      When using the hostname property the following ERROR message is logged:

      Appender [EMAIL] of type [ch.qos.logback.classic.net.SMTPAppender] has no appplicable [HOSTNAME] property

      Configuration as below:
      =======================================================
      import ch.qos.logback.classic.encoder.PatternLayoutEncoder
      import ch.qos.logback.core.ConsoleAppender
      import ch.qos.logback.classic.net.SMTPAppender
      import ch.qos.logback.core.status.OnConsoleStatusListener
      import ch.qos.logback.classic.PatternLayout
      import ch.qos.logback.classic.html.HTMLLayout

      import static ch.qos.logback.classic.Level.TRACE
      import static ch.qos.logback.classic.Level.DEBUG
      import static ch.qos.logback.classic.Level.INFO
      import static ch.qos.logback.classic.Level.WARN
      import static ch.qos.logback.classic.Level.ERROR

      statusListener(OnConsoleStatusListener)

      def appenderList = ["Console"]
      def enable_email = true

      if(enable_email) {
      appender("EMAIL", SMTPAppender) {
      SMTPHost = "smtp.gmail.com"
      SMTPPort = 587
      STARTTLS = true
      username = "username"
      password = "password"
      to = "to@demo.com"
      from = "from@demo.com"
      subject = "ERROR from ${HOSTNAME}: %logger

      {20}

      - %m"
      layout(HTMLLayout) {
      pattern = "%d

      {HH:mm:ss.SSS}

      %thread%-5level%logger

      {36}%msg"
      }
      }
      appenderList.add("EMAIL")
      }

      appender("Console", ConsoleAppender) {
      encoder(PatternLayoutEncoder) {
      pattern = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}

      - %msg%n"
      }
      }

      logger("org.celllife", INFO)

      scan("30 seconds")

      root(ERROR, ["Console", "EMAIL"])

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            simongdkelly@gmail.com Simon Kelly
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: