You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Pankaj C <pc...@ivp.in> on 2012/06/06 18:34:42 UTC

Multiple smtphost addresses using log4net

I want to be able to specify multiple smtp server host addresses and
implement a logic whereby if email using one smtp server fails, it tries to
send using the next smtp server address. Is it possible using log4net. Can
we override something and implement our own logic?
 
<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
      <to value="group@ivp.in" />
      <from value="uname@ivp.in" />
      <subject>Error Notification</subject>
      <smtpHost value="smtp.gmail.com" />
      <authentication value="Basic" />
      <port value="587" />
      <username value="uname@company.com" />
      <password value="" />
      <bufferSize value="1" />
      <EnableSsl value="true"/>
      <lossy value="true" />
      <evaluator type="log4net.Core.LevelEvaluator">
        <threshold value="ERROR"/>
      </evaluator>
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%newline%date [%thread] %level %logger -
%message%newline%newline%exception" />
      </layout>
    </appender>
-- 
View this message in context: http://old.nabble.com/Multiple-smtphost-addresses-using-log4net-tp33971096p33971096.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Re: Multiple smtphost addresses using log4net

Posted by Stefan Bodewig <bo...@apache.org>.
On 2012-06-06, Pankaj C wrote:

> I want to be able to specify multiple smtp server host addresses and
> implement a logic whereby if email using one smtp server fails, it tries to
> send using the next smtp server address. Is it possible using log4net. Can
> we override something and implement our own logic?

It is not that simple, party because we have to support two different
mail APIs for 1.x and later.  You can override SmtpAppender's SendEmail
method but will have to duplicate quite a bit of the existing code.

Stefan