You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by king kele <ke...@hotmail.com> on 2007/02/05 06:00:20 UTC

utilize logging functionality in my add-in

I've used log4net in several project.It's good.
But now, the problem is I want to use log4net for logging in my vs2005 
add-in, it's a class library assembly.
Previously, I use log4net in terms of standlone application such as windows 
application, asp.net application etc. Now it's an class library.
Anyone can tell me how to use log4net in my add-in for logging?
Thanks in advance.

_________________________________________________________________
免费下载 MSN Explorer:   http://explorer.msn.com/lccn/  


RE: utilize logging functionality in my add-in

Posted by wang junwei <ke...@hotmail.com>.
Thank you Dean for your suggestion.
Now I have figured out how to get there.
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 I can use logging function as usual in my add-in assembly.

Thanks again Dean. Hope this can help others.

>From: "Dean Fiala" <df...@celadonlabs.com>
>Reply-To: "Log4NET User" <lo...@logging.apache.org>
>To: "'Log4NET User'" <lo...@logging.apache.org>
>Subject: RE: utilize logging functionality in my add-in
>Date: Tue, 6 Feb 2007 13:10:39 -0500
>
>The only thing that is different is that the context of the library is the 
VS2005 executable and not something you have written yourself. It's been a 
while since I've worked with add-ins, but I imagine that there is a some 
sort of start up method that is called when the add-in is loaded.  What 
you'd need to here is have the method configure your logging, either 
programmitically or by using the XmlConfigurator.  The trickiest part will 
be determining the file locations for the configuration and/or output, but 
either the .NET AppDomain or Environment classes will let you know where 
the application is working and you can work from there.
>
>HTH,
>
>Dean Fiala
>
>Chief Technology Officer
>Celadon Laboratories, Inc.
>http://www.celadonlabs.com
>
>
>
>
>-----Original Message-----
>From: king kele [mailto:kelekingone@hotmail.com]
>Sent: Monday, February 05, 2007 12:00 AM
>To: log4net-user@logging.apache.org
>Subject: utilize logging functionality in my add-in
>
>I've used log4net in several project.It's good.
>But now, the problem is I want to use log4net for logging in my vs2005 
add-in, it's a class library assembly.
>Previously, I use log4net in terms of standlone application such as 
windows application, asp.net application etc. Now it's an class library.
>Anyone can tell me how to use log4net in my add-in for logging?
>Thanks in advance.
>
>_________________________________________________________________
>免费下载 MSN Explorer:   http://explorer.msn.com/lccn/
>
>
>
>

_________________________________________________________________
�����������ѽ��н�������ʹ�� MSN Messenger:  http://messenger.msn.com/cn  


RE: utilize logging functionality in my add-in

Posted by wang junwei <ke...@hotmail.com>.
Thanks Dean. I will try it. 
I'll post in this list to detail how to get it work if I success.


>From: "Dean Fiala" <df...@celadonlabs.com>
>Reply-To: "Log4NET User" <lo...@logging.apache.org>
>To: "'Log4NET User'" <lo...@logging.apache.org>
>Subject: RE: utilize logging functionality in my add-in
>Date: Tue, 6 Feb 2007 13:10:39 -0500
>
>The only thing that is different is that the context of the library is the 
VS2005 executable and not something you have written yourself. It's been a 
while since I've worked with add-ins, but I imagine that there is a some 
sort of start up method that is called when the add-in is loaded.  What 
you'd need to here is have the method configure your logging, either 
programmitically or by using the XmlConfigurator.  The trickiest part will 
be determining the file locations for the configuration and/or output, but 
either the .NET AppDomain or Environment classes will let you know where 
the application is working and you can work from there.
>
>HTH,
>
>Dean Fiala
>
>Chief Technology Officer
>Celadon Laboratories, Inc.
>http://www.celadonlabs.com
>
>
>
>
>-----Original Message-----
>From: king kele [mailto:kelekingone@hotmail.com]
>Sent: Monday, February 05, 2007 12:00 AM
>To: log4net-user@logging.apache.org
>Subject: utilize logging functionality in my add-in
>
>I've used log4net in several project.It's good.
>But now, the problem is I want to use log4net for logging in my vs2005 
add-in, it's a class library assembly.
>Previously, I use log4net in terms of standlone application such as 
windows application, asp.net application etc. Now it's an class library.
>Anyone can tell me how to use log4net in my add-in for logging?
>Thanks in advance.
>
>_________________________________________________________________
>免费下载 MSN Explorer:   http://explorer.msn.com/lccn/
>
>
>
>

_________________________________________________________________
�������������ĵ����ʼ�ϵͳ�� MSN Hotmail��  http://www.hotmail.com  


RE: utilize logging functionality in my add-in

Posted by Dean Fiala <df...@celadonlabs.com>.
The only thing that is different is that the context of the library is the VS2005 executable and not something you have written yourself. It's been a while since I've worked with add-ins, but I imagine that there is a some sort of start up method that is called when the add-in is loaded.  What you'd need to here is have the method configure your logging, either programmitically or by using the XmlConfigurator.  The trickiest part will be determining the file locations for the configuration and/or output, but either the .NET AppDomain or Environment classes will let you know where the application is working and you can work from there.

HTH,

Dean Fiala

Chief Technology Officer
Celadon Laboratories, Inc.
http://www.celadonlabs.com




-----Original Message-----
From: king kele [mailto:kelekingone@hotmail.com] 
Sent: Monday, February 05, 2007 12:00 AM
To: log4net-user@logging.apache.org
Subject: utilize logging functionality in my add-in

I've used log4net in several project.It's good.
But now, the problem is I want to use log4net for logging in my vs2005 add-in, it's a class library assembly.
Previously, I use log4net in terms of standlone application such as windows application, asp.net application etc. Now it's an class library.
Anyone can tell me how to use log4net in my add-in for logging?
Thanks in advance.

_________________________________________________________________
免费下载 MSN Explorer:   http://explorer.msn.com/lccn/