logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Wallis" <mail...@wallis.ca>
Subject Re: Extending Log4Net
Date Wed, 01 Feb 2006 18:33:36 GMT
I don't quite understand your example of the LogEntry object. However, check out the sample
code that is included with the log4net distribution. There are full examples that show how
to extend log4net. I have done it quite a bit and it works well. Yes it is easy enough to
write your own appenders that extend AppenderSkeleton, just examine the source code because
that's what all the appenders do, so you can just copy and paste.

Simon.

-----Original message-----
From: "Fahad Sarwar" fsarwar@opaltelecom.co.uk
Date: Tue, 17 Jan 2006 10:06:35 -0800
To: "'Log4NET User'" log4net-user@logging.apache.org
Subject: Extending Log4Net

> Hi,
>  
> I have just started to use the latest version of log4net 1.2.9 and would
> like to know how best to extend its capabilites to do what i need.  We
> currently have our own logging application which takes an object called
> LogEntry (containing 5 parameters including a Message field) and makes use
> of MSMQ and WebService technology.  
>  
> It is easy enough to write an Appender which extends AppenderSkeleton and
> overrides the Append method to make a call to the WebService.  But the
> difficulty is getting the LogEntry object to the Appender to send to the
> WebService.  What would be the best way to do this?  I guess itll involve
> the DefaultRenderer class in someway but not sure how to use this or how to
> extend it to pass on the LogEntry object.  
>  
> Within our code we use the patternlayout as its the most flexible and
> provides the most information.  I would like to extend this class to log
> each item within the LogEntry object as a seperate attribute, i.e.
> LogEntry.Category can use %cat, LogEntry.Application %app etc.  However i
> would like the LogEntry.Message property to use the %m / %message tag and
> dont want every property within object to outputted to an appender when %m /
> %message is used.  Any ideas how this can be achieved?
>  
>  
> 
> Fahad Sarwar
> 
> Opal Telecom
> 
> Applications Team
> 
> Irlam
> 
> Tel: +44 161 222 2145
> 
> Fax: +44 161 222 2008
> 
> Email: fsarwar@opaltelecom.co.uk 
> 
>  
> 
> This communication together with any attachments transmitted with it ("this
> E-Mail") is intended only for the use of the addressee and may contain
> information which is privileged and confidential. If the reader of this
> E-Mail is not the intended recipient or the employee or agent responsible
> for delivering it to the intended recipient you are hereby notified that any
> use, dissemination, forwarding, printing or copying of this E-Mail is
> strictly prohibited. Addressees should check this E-mail for viruses. The
> Company makes no representations as regards the absence of viruses in this
> E-Mail. If you have received this E-Mail in error please notify our IT
> Support Team immediately by telephone on 0845 456 9100 or via e-mail at
> support@opaltelecom.co.uk Please then immediately delete, erase or otherwise
> destroy this E-Mail and any copies of it.
> 
> Any opinions expressed in this E-Mail are those of the author and do not
> necessarily constitute the views of the Company. Nothing in this E-Mail
> shall bind the Company in any contract or obligation.
> 
> For the purposes of this E-Mail "the Company" means Opal Telecom Ltd.
> Please feel free to visit our website:  <http://www.opaltelecom.co.uk/>
> www.opaltelecom.co.uk
> 
> Opal Telecom Ltd (Registered in England & Wales No. 3849133) 
> 
> Brinell Drive, Northbank Industrial Park, Irlam, Manchester M44 5BL.
> 
> A member of the Carphone Warehouse Group of Companies
> 
>  
> 


Mime
View raw message