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: Getting the exception in a filter
Date Wed, 15 Dec 2004 13:06:32 GMT
Bill,

In 1.2 beta 8 it is not possible to retrieve the exception object from
the LoggingEvent. Only a rendered string can be retrieved.
This has been fixed in CVS with the addition of the ExceptionObject
property.

You can either:
1) Parse the rendered exception string for the data you need.
2) Modify log4net locally to add the ExceptionObject to LoggingEvent.
3) Checkout and build the latest version from CVS.

Cheers,
Nicko

> -----Original Message-----
> From: Bill.Martin@Marlborough-Stirling.com 
> [mailto:Bill.Martin@Marlborough-Stirling.com] 
> Sent: 14 December 2004 12:37
> To: log4net-user@logging.apache.org
> Subject: Getting the exception in a filter
> 
> I need to be able to ignore specific exceptions in log4net 
> from within the config file (specifically, the 
> ThreadAbortException).  I can't see any way of doing this 
> with the existing functionality, so was going to write a 
> custom filter to do it.  It would appear, however, that I 
> can't get the Exception object of the LoggingEvent object 
> passed in to the Decide method.
> I can get a rendered version of it from the 
> GetExceptionStrRep method, but I would consider this as 
> unreliable as I cannot guarantee how the exception will be rendered.
> 
> Anyone know a way of getting the underlying exception?
> 
> Cheers,
> 
> Bill
> 
> 
> We would like to take this opportunity to offer seasons 
> greetings from all at Marlborough Stirling. Rather than 
> sending out Christmas cards this year, we will be making a 
> contribution to the charity Crisis - www.crisis.org.uk. We 
> are delighted to be able to support the work of this 
> worthwhile charity, who offer vital services and emotional 
> support at a particularly vulnerable time of the year.
> 
> 
> 
> UK businesses use 2 million tonnes of paper each year.
> THINK before you PRINT this email.
> ______________________________________________________________
> 
> CONFIDENTIALITY NOTICE
> 
> This communication and the information it contains is 
> intended for the person or organisation to whom it is 
> addressed.  Its contents are confidential and may be 
> protected in law.  Unauthorised use,  copying or disclosure 
> of any of it may be unlawful.  If you are not the intended 
> recipient, please contact us immediately.
> 
> The contents of any attachments in this e-mail may contain 
> software viruses, which could damage your own computer 
> system.  While Marlborough Stirling has taken every 
> reasonable precaution to minimise this risk, we cannot accept 
> liability for any damage, which you sustain as a result of 
> software viruses.  You should carry out your own virus 
> checking procedure before opening any attachment.
> 
> Marlborough Stirling plc, Registered in England and Wales 
> Registered No. 3008820, Jessop House, Jessop Avenue, 
> Cheltenham, Gloucestershire, GL50 3SH
> Tel: 01242 547000     Fax: 01242 547100
> http://www.marlborough-stirling.com
> 
> 

Mime
View raw message