
[ http://jira.qos.ch/browse/LBCLASSIC-227?page=com.atlassian.jira.plugin.syste... ] Simon Kelly commented on LBCLASSIC-227: --------------------------------------- The property is also not resolved if used in a def statement: def hostname = "${HOSTNAME}" Stack trace: =========================== Exception in thread "Thread-19" groovy.lang.MissingPropertyException: No such property: HOSTNAME for class: Script1 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:239) at Script1.run(Script1.groovy:18) at Script1$run.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:58) at ch.qos.logback.classic.gaffer.GafferConfigurator$run$0.callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149) at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:41) at ch.qos.logback.classic.gaffer.GafferUtil.runGafferConfiguratorOn(GafferUtil.java:37) at ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter$ReconfiguringThread.run(ReconfigureOnChangeFilter.java:177)
HOSTNAME property not resolved ------------------------------
Key: LBCLASSIC-227 URL: http://jira.qos.ch/browse/LBCLASSIC-227 Project: logback-classic Issue Type: Bug Affects Versions: 0.9.26 Reporter: Simon Kelly Assignee: Logback dev list
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"])
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira