try changing your log directory. did you check whether ASPNET process is not recycled(killed and restarted)
Thanks and regards, Jayakumar Budamala Citigroup Architecture & Technology Engineering (CATE) - EIT _____ From: phani nadigadda [mailto:[EMAIL PROTECTED] Sent: Thursday, May 03, 2007 11:11 AM To: Log4NET User Subject: Re: Need help on testing dll, that uses external configuration file, using Nunit. I am saving my log file in my_project_name\bin\ and my web.config is in my_project_name\ folder On 5/3/07, Budamala, Jayakumar <[EMAIL PROTECTED]> wrote: check whether your IIS is recycled, and also let me know where is your log file destination, if its is in same path as web.config, move it to different directory. May be it can help you.. Thanks and regards, Jayakumar Budamala _____ From: phani nadigadda [mailto:[EMAIL PROTECTED] Sent: Thursday, May 03, 2007 10:39 AM To: Log4NET User Subject: Re: Need help on testing dll, that uses external configuration file, using Nunit. Jayakumar Budamala, I am able to read the config file successfully using the followed code Global.asax Application_Start log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "web.config ")); And also I am able to log the messages from my pages. The thing is I have some sessions in my web applications, they are running fine untill the log.Info("My Message") code executes to log the messages to my log file. Once this code executes then all my sessions are getting expired. I am not sure why it is behaving very strange in nature. Followed is my code in Global.asax and my .cs code and web.config configuration. Please go through if you get a chance and help me out. My Web.Config <?xml version ="1.0" encoding="utf-8"?> <configuration> <configSections> <section name ="log4net" type="System.Configuration.IgnoreSectionHandler"/> </configSections> <appSettings> </appSettings> <log4net> <appender name ="AspNetTraceAppender" type="log4net.Appender.AspNetTraceAppender"> <layout type ="log4net.Layout.PatternLayout"> <conversionPattern value ="%date %-5level - %message%newline"/> </layout> </appender> <appender name ="LogFileAppender" type="log4net.Appender.FileAppender"> <file value ="bin\MyProject-Log.log"/> <appendToFile value ="true"/> <layout type ="log4net.Layout.PatternLayout"> <header value ="My Project Startup..."/> <footer value ="My Project Shutdown..."/> <conversionPattern value ="%date %-5level - %message%newline"/> </layout> </appender> <root> <level value ="ALL"/> <appender-ref ref ="LogFileAppender"/> </root> <logger name ="MyLogger"> <level value ="ALL"/> <appender-ref ref ="AspNetTraceAppender"/> </logger> </log4net> <system.web> <compilation defaultLanguage ="c#" debug="true"/> <customErrors mode="RemoteOnly" defaultRedirect="DefaultError.aspx"/> <authentication mode="Forms"> <forms loginUrl ="login.aspx" name="adAuthName" t㬬meout="60" path="/"/> </authentication> <authorization> <deny users ="?"/> <allow users ="*"/> <!-- Allow all users --> </authorization> <identity impersonate ="true"/> <trace enabled ="false" requestLimit="10" pageOutput="false" traceMode ="SortByTime" localOnly="true"/> <sessionState mode ="InProc" stateConnectionString="tcpip= 127.0.0.1:42424 <http://127.0.0.1:42424/> " sqlConnectionString="data source= 127.0.0.1 <http://127.0.0.1/> ;Trusted_Connection=yes" cookieless="false" timeout ="20"/> <globalization requestEncoding ="utf-8" responseEncoding="utf-8"/> </system.web> </configuration> Global.asax protected void Application_Start(Object sender, EventArgs e) { log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "web.config")); } .CS code private static readonly ILog log = log4net.LogManager.GetLogger (System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); if(log.IsInfoEnabled) log.Info(strMessage); Thank you On 5/3/07, Budamala, Jayakumar <[EMAIL PROTECTED] > wrote: 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] <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] <mailto:[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 <http://nabble.com/> . -- Phani Prathap Nadigadda -- Phani Prathap Nadigadda
