Details
-
Bug
-
Resolution: Won't Fix
-
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
- %m"
layout(HTMLLayout) {
pattern = "%d
%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
Issue Links
- relates to (out)
-
LOGBACK-1118 logback.groovy/Gaffer variable scope is broken
- Open