logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Venkatasamy, Vanitha" <Vanitha.Venkatas...@xpandcorp.com>
Subject RE: How to set the category and EventId in EventLog log4net
Date Wed, 26 Oct 2011 18:27:38 GMT

Thank you for the reply .

 Yes you are right, it's not going to hit the last block.

          if ((log.IsErrorEnabled) && ((checkException.GetHttpCode() == 500) || (checkException.GetHttpCode()
== 404)))


               if(checkException.GetHttpCode() == 500)

                 log4net.ThreadContext.Properties["Category"] = "500";


                 log4net.ThreadContext.Properties["Category"] = "404";

                 log.Error("Error" + sbErrorMessage.ToString() );


            else if (log.IsWarnEnabled)


              log.Warn("Warning" + sbErrorMessage.ToString());


             else if (log.IsInfoEnabled)


               log.Info("Information" + sbErrorMessage.ToString());                      


Yes you are correct ,I want to  switch the level on the type of exception raised. The code
is in Global.asax and I tried to get the innerExeception

See the attachment

Since the

        if (objErr.GetType() == typeof(HttpException))


                checkException = (HttpException)objErr;


checkException.GetHttpCode() =500 ,all the error are going into log.Error in my custom Event
log.  But if I check the system-application log,its logged as "Application" level.



-----Original Message-----
From: Stefan Bodewig [mailto:]
Sent: Wednesday, October 26, 2011 12:09 PM
To: Log4NET User
Subject: Re: How to set the category and EventId in EventLog log4net

On 2011-10-25, Venkatasamy, Vanitha wrote:

> 1.The version of log4net.dll I am using is 1.2.10 .

As you've already seen, you needed to upgrade.

Is there still any issue left?



This message contains Devin Group confidential information and is intended only for the individual
named. If you are not the named addressee you should not disseminate, distribute or copy this
Please notify the sender immediately by e-mail if you have received this e-mail in error and
delete this e-mail from your system. E-mail transmissions cannot be guaranteed secure, error-free
and information could be intercepted, corrupted, lost, destroyed, arrive late, incomplete,
or contain viruses. The sender therefore does not accept liability for errors or omissions
in the contents of this message which may arise as result of transmission. If verification
is required please request hard-copy version.

View raw message