Loading...

log4net-user@logging.apache.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Wrapping Log4Net in a Facade --> incorrect LocationInfo shown for file, methods.... Ron Grabowski Thu Jan 18 18:02:48 2007

I believe the pattern is called "abstract factory". 

Your facade needs to perform logging using the methods on ILogger and passing 
in the Type of your wrapper class. See this class for an implementation and 
comments as to why its necessary:



http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/Log4NetLogger.cs?revision=293509&view=markup



IBatisNet (ibatis.apache.org), Sooda (www.sooda.org), and The Castle Project 
(www.castleproject.org) have abstracted logging libraries (to allow the user to 
switch between log4net, NLog, and some simple builtin loggers like a 
ConsoleLogger) that do similiar things. I recall there being similiar code on 
gotdotnet.com sonewhere too.


----- Original Message ----

From: José Joye <[EMAIL PROTECTED]>

To: [EMAIL PROTECTED]

Sent: Thursday, January 18, 2007 1:54:06 PM

Subject: Wrapping Log4Net in a Facade  --> incorrect LocationInfo shown for 
file, methods....



         Hello,

  

 We are trying the Log4Net in our projects. However,  for different reasons, we 
want to expose it to our developers through a  Tracing/Error class facade.

 Doing so, we face the following  problem:

  

 Whenever an Appender print information about  LocationInfo (File, line, 
Method,....). It will take information related to the  caller of the Log4Net 
method (which is the facade in our case).

  

 Is there any way to tell Log4Net not to walk more  more level on the 
stackTrace so as to retrieve the information?

  

 Thanks a lot!

  

 - Jose