logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: SmtpAppender configuration error
Date Thu, 15 Dec 2005 17:21:16 GMT
You could set the SMTP host name to the name of the local computer
rather than empty string

<SmptHost value="${COMPUTERNAME}" />

Cheers,
Nicko

> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of TomekR
> Sent: 15 December 2005 16:32
> To: log4net-user@logging.apache.org
> Subject: SmtpAppender configuration error
> 
> Hello !
> 
> (I've browsed this list to avoid duplicate threads, but if 
> this problem was already announced then forgive me).
> Let imagine following scenario: 
> 
> 1.
> my app uses smpt appender, which is configured using 
> ConfigureAndWatch. 
> Initially the property smtpHost is set to MyMailServer.net.
> 
> Some log events occured so some e-mails was sent, what 
> results, that SmtpMail.SmtpServer is set to MyMailServer.net
> 
> 2.
> Then user changes mail server and sets empty string with 
> intention to use local smtp server.
> The appender reloads configuration and sets its property to 
> empty string.
> BUT the emails are sent directed to previous mail server !!! 
> Why ? Becouse of
> that:
> (ending part of SendBuffer method)
> 
> if (m_smtpHost != null && m_smtpHost.Length > 0) {
> 	SmtpMail.SmtpServer = m_smtpHost;
> }
> 
> Since appender property i.e. smtpHost is empty, then if 
> condition prevents change of SmtpServer property.
> IMO, this setting should be done unconditionally.
> 
> Regards,
> --
> Tomek
> 
> 

Mime
View raw message