logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Joye <jose.j...@bluewin.ch>
Subject Re: Wrapping Log4Net in a Facade --> incorrect LocationInfo shown for file, methods....
Date Fri, 19 Jan 2007 20:39:18 GMT
Ron,

Many thanks for your answer. This was exactly what I was looking for.
This is an elegant solution!

The only question I still have is the following:
The link you pointed me to (Log4NetLogger.cs) had only a partial 
implementation of the ILog. This was not complicated to fill the gap. 
However, I was just asking myself why this class only partially implemented 
the interface.

Thanks again,

- José
----- Original Message ----- 
From: "Ron Grabowski" <rongrabowski@yahoo.com>
To: "Log4NET User" <log4net-user@logging.apache.org>
Sent: Thursday, January 18, 2007 10:53 PM
Subject: Re: Wrapping Log4Net in a Facade --> incorrect LocationInfo shown 
for file, methods....


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 <jose.joye@bluewin.ch>

To: log4net-user@logging.apache.org

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













Mime
View raw message