logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wang junwei" <keleking...@hotmail.com>
Subject RE: Calling Configure serveral time
Date Thu, 08 Feb 2007 08:38:32 GMT
Hi, Sergey.
I met the same problem as you do. I want to use log4net in my VS2005 
add-in. It's a class library assembly and hosted in devenv.exe(VS2005 IDE). 
Now I have figured out how to get there after I post in this mailist and 
got help from Dean Fiala. Thank you very much Dean Fiala. Here is these 
steps:
1.place your separate log4net configuration whatever location take 
C:\config\log4netcfg.xml for example.
2.my add-in is an assembly which recursively references other assemblies, 
Now I can programatically configure log4net environment in add-in's default 
constructor(typically AddInName.Connect) using
log4net.Config.XmlConfigurator.ConfigureAndWatch(new 
FileInfo("C:\\config\\log4netcfg.xml"));
3.then you can use logging function as usual in your component.

HTH


>From: Sergey <iwds@udm.ru>
>Reply-To: "Log4NET User" <log4net-user@logging.apache.org>
>To: log4net-user@logging.apache.org
>Subject: Calling Configure serveral time
>Date: Thu, 8 Feb 2007 07:23:32 +0000 (UTC)
>
>Hi, All
>
>I want to use log4net in my component that will be hosted in an 
application.
>I'm going to initialize log4net with XmlConfigurator.Configure(fileName) 
when
>my object is being constructed. The point I'm not sure of is my object can 
be
>created several times by the application. The application does not use 
log4net
>itself. Is there any pottential problem calling XmlConfigurator.Configure
>several times? Will it affect log4net in some way?
>
>Regards,
>Sergey
>

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn  


Mime
View raw message