Thanks a lot for the info! It enabled me to find this article: 822752 - PRB: Application Configuration File Is Deleted When You Build the Solution http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B822752
That fixed the problem. David -----Original Message----- From: Dag Christensen [mailto:[EMAIL PROTECTED] Sent: Monday, June 14, 2004 8:22 AM To: Log4NET User Subject: RE: log4net deleting config file at startup Check if you have a file called app.config in your project. When you build the project, Visual Studio will copy app.config to the build folder as application.exe.config, thus overwriting your file. This occurs when you build the project, so running the exe directly won't cause the file to be overwritten. The solution is to store your settings in the project's app.config file and you should be ok. I believe the samples provided with log4net do this. App.config is created automatically by Visual Studio when you use dynamic properties in a windows form, I'm not sure what else triggers creation of this file. Regards, Dag -----Original Message----- From: David Resnick [mailto:[EMAIL PROTECTED] Sent: Sunday, June 13, 2004 1:38 PM To: Log4NET User Subject: RE: log4net deleting config file at startup A little more information: 1. The config file is not deleted when I run my app from EXE (without the debugger) and in that case logging works fine. 2. The file is deleted before any code is run in my app. So by the time the following line is reached by the debugger, the config file is already gone: private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMeth od().DeclaringType); 3. If I replace the config file while at a breakpoint on the above line, logging works fine. David -----Original Message----- From: David Resnick Sent: Sunday, June 13, 2004 12:30 PM To: [email protected] Subject: log4net deleting config file at startup I am having a strange problem. I would like to use log4net from a Windows Forms application. I am trying to configure log4net using the directive: [assembly: log4net.Config.DOMConfigurator(Watch=true)] I named a config file the same as my EXE with ".config" appended (using the config file from the ConsoleApp example). When I start up my app, my config file is deleted. I tried doing the same things in a simple test Windows Form application (basically copying the relevant lines of code from the ConsoleApp example application) and it works fine. I have tried using different methods of naming my XML configuration file (using different directives) and while that stops the config file from being deleted, logging is not enabled. I am using .Net 2003, and log4net version 1.2.0.30714. Any suggestions welcome! David
