Will this work?

private int calculateBigNumber(bool loggingEnabled)

{

 if (loggingEnabled && log.IsDebugEnabled)

 {

  log.Debug("Entering method");

 }

 int result = 0;

 for (int i=0;i<100;i++)

 {

  result += i;

 }

 if (loggingEnabled && log.IsDebugEnabled)

 {

  log.Debug("Leaving method");

 }

 return result;

}



----- Original Message ----

From: Ramaa Davanagere <[EMAIL PROTECTED]>

To: "[email protected]" <[email protected]>

Sent: Tuesday, September 26, 2006 2:28:19 PM

Subject: Turn off logging for a specific event only



           <!--  _filtered {font-family:"Comic Sans MS"; panose-1:3 15 7 2 3 3 
2 2 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:"Comic Sans MS"; color:windowtext; font-weight:normal; 
font-style:normal; text-decoration:none none;}  _filtered { margin:1.0in 1.25in 
1.0in 1.25in;} div.Section1         {} -->        

  Is it possible to turn off the logging for a specific event? I would like to 
turn of the logging when the code hits a particular method and reset the 
logging to its original value which is "DEBUG" while exiting that method. Is it 
possible to accomplish this? If so, please provide me some sample code on how 
to achieve this. My code is in c#.net and uses log4net version 1.2.10

   

  Please help 

   

  Thanks.

   

  -Ramaa

  

  







Reply via email to