I figured it out..
In app.config, I gave the key
ConfigFile = "~\log4net.config" ;
And made the file called myext.dll.config and included in the bin
directory.

In  my extension dll, I read this path using the code

                        ConfigPath =
SystemInfo.GetAppSetting("ConfigPath");
                        if (!this._configured) 
                        {
                                if(null != ConfigPath &&
ConfigPath.Length > 0)
                                {

                                        if (ConfigPath.StartsWith("~/")
|| ConfigPath.StartsWith("~\\"))
                                        {
                                                ConfigPath =
Path.Combine(AppDomain.CurrentDomain.BaseDirectory.TrimEnd('/', '\\') +
"/", ConfigPath.Substring(2));
                                        }
                                

                                        System.IO.FileInfo fi = new
System.IO.FileInfo(ConfigPath);
                                        if(fi.Exists == false)
                                        {
                                                LogLog.Error("log
configfile not found", new ApplicationException("Cannot find log4net
configuration file at " + fi.FullName));
                                                Configure();
                                                _configured = true;
                                        }
                                        else
                                        {
                                                ConfigureAndWatch(fi);
                                        }
                                }
                                else
                                {
                                        Configure();
                                        _configured = true;
                                                
                                }


It works.

Could you comment, if I miss anything, for the configuration side.


Thanks and regards, 
Jayakumar Budamala 
Citigroup Architecture &  Technology Engineering (CATE)  - EIT
Citigroup Campus 
283, King George Rd 
Warren, NJ - 07059 
Tel : 908-563-3064


-----Original Message-----
From: Ron Grabowski [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 02, 2007 7:39 PM
To: Log4NET User
Subject: Re: Need help on testing dll, that uses external configuration
file, using Nunit.

Is your extension dll looking for the correct configuration file? Can
you post code where it fails to read the config file?

----- Original Message ----
From: JkReddy <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, May 2, 2007 10:28:44 AM
Subject: Need help on testing dll, that uses external configuration
file, using Nunit.


I have extended the log4net , to suite my requirements. 
Now I want to write, the unit tests for that library, using external
log4net configuration file. 

I want to use Nunit. My question is how to test my dll, with the use of
external log configuration file. Could you point me in the right
direction. 

In my extension dll, the code  looking for the config file, in base
directory, but not successfull getting config file read.

--
View this message in context:
http://www.nabble.com/Need-help-on-testing-dll%2C-that-uses-external-con
figuration-file%2C-using-Nunit.-tf3680882.html#a10286867
Sent from the Log4net - Users mailing list archive at Nabble.com.




Reply via email to