You have a more complicated setup than I have dealt with in .net, but
in java it was easy enough. I sure hope it's that way here.
I have a "log4net.config " file in my app directory
I do *not* initialize log4net anywhere
In my assemblyinfo is this line which causes log4net to reload itself
if the config changes:
<Assembly: log4net.Config. XmlConfigurator (ConfigFile:="l og4net.config",
ConfigFileExten sion:="config", Watch:=True)>
At the top of each class is this generic code :
Private Shared ReadOnly log As ILog =
LogManager.GetL ogger(System.Re flection.Method Base.GetCurrent Method().Declar ingType)
This gets a logger based on the class being instantiated. In other
versions with the plain text config file you could always just
reference your class/namespace like this :
"log4j.logger.c om.myapp.data=d ataquerylog,ema ilerrorlog" and it would
use those loggers for all classes in that namespace that loaded a
logger that was not explicitly named (ie, FastLogger). I assume there
is a way to do this in the xml config file (or maybe it supports a text
config too?) and maybe that is what you are looking for.
Hope this helps. If a second exe is run in the same working directory
I think it would load up the same log4net.config (xml format) when run.
HTH, and sorry I can't be much more help than that.
// Andrew
ch***********@g mail.com wrote:
Hi all,
I would like to implement log4net for logging my application. First
let me describe in short about the application. I have a solution with
two exe file outputs and several dll assemblies. And my application has
a different AppDomain as it is a customization of another COM based
application written in VB.NET.
I have tried with App.Config files in my startup exe applications. It
works fine only till the parent application is loaded after that even
though the customized assemblies are used. My logging is not happening.
I am using the following set of code in every class.
1) log4net.Config. DOMConfigurator .Configure(); in every class'
constructor
2) Private Shared ReadOnly log as ILog =
LogManager.GetL ogger(GetTypeof (FastLogger));
My installation folder has the following files apart from other
assemblies:
1) MyApp.Exe
2) MyApp.Exe.Confi g
3) But it starts another application ForeignApp.exe in some other
folder.
Can anyone please help me in this regard.
Thanks in anticipation,
Chidam