[logback-dev] [JIRA] Commented: (LBCLASSIC-227) HOSTNAME property not resolved

Ceki Gulcu (JIRA) noreply-jira at qos.ch
Thu Feb 10 13:41:51 CET 2011


    [ http://jira.qos.ch/browse/LBCLASSIC-227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11958#action_11958 ] 

Ceki Gulcu commented on LBCLASSIC-227:
--------------------------------------

In the chapter on groovy [1], there is a section on the hostname variable. Search "Automatically exported fields".  The paragraph starting with "If you wish to have the hostname variable be seen in all scopes, ..." is particularly relevant in this context.

Please close this report if the above information solved the issue.

[1] http://logback.qos.ch/manual/groovy.html

> 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: Ceki Gulcu
>
> 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 at demo.com"
> 	  from = "from at 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

        


More information about the logback-dev mailing list