logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: Programatically disable email
Date Fri, 11 Jan 2008 00:53:26 GMT
Have you tried iterating through the appenders in the repository and setting the threshold
for your SmtpAppender?

// untested
IAppender[] appenders = LogManager.GetRepository().GetAppenders();
foreach (IAppender appender in appenders)
{
    SmtpAppender smtpAppender = (SmtpAppender)appender;
    if (smtpAppender != null)
    {
        smtpAppender.Threshold = Level.Off;
        smtpAppender.ActivateOptions();
    }
}

----- Original Message ----
From: Erlis Vidal <Evidal@affiliated.ca>
To: Log4NET User <log4net-user@logging.apache.org>
Sent: Monday, December 24, 2007 9:18:53 AM
Subject: Programatically disable email 





 
 

<!--
 _filtered {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;text-decoration:underline;}
span.EmailStyle17
	{font-family:Calibri;color:windowtext;font-weight:normal;font-style:normal;text-decoration:none
none;}
 _filtered {margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{}
-->






Hi all!
 

  
 

My current configuration use an smtpAppender with a LevelRangerFilter
setted in order to send ERROR messages, but in some cases I would like to
disable the email capabilities, in order to achieve something similar to the
previous discussion of “Elapsed time evaluator” but in my case I
want to manage this in my code.
 

  
 

Is there any idea for this?
 

Thanks in advance and Merry Christmas to everybody.
 

  
 

--Erlis
 








Mime
View raw message