Are you sure you're closing the Stream? 

using (Stream logSettingsStream = getLogSettingsStream())
{
    log4net.Config.XmlConfigurator.Configure(stream);

}

Does this work:

XmlConfigurator.Configure(
 new FileInfo(
 AppDomain.CurrentDomain.SetupInformation.ApplicationBase +
 "/Config/Files/LogSettings.xml"));

----- Original Message ----

From: "McAninch, Robin J" <[EMAIL PROTECTED]>

To: [email protected]

Sent: Thursday, February 1, 2007 1:01:25 PM

Subject: Configuration problem (locking files)



 
I have been given an application consisting of 5 web projects and 5 back end 
objects into which I would like to introduce log4net.  I don’t have a master 
web.config file (no hierarchy) so I was trying to put the configuration 
settings into one xml file on the server and introduce code into the global 
asax to configure each project on Application_Start (.NET 1.1 C#).  The problem 
I have is the lock on the file from the first project precludes the others from 
reading it.  Is there any way around this short of having a config file for 
each project?

     

   StringBuilder uri = new StringBuilder();

                     

   string myURL = string.Empty;

     

   //  Get config file path

   uri.Append(Server.MapPath("/Config"));

   uri.Append("/Files/LogSettings.xml");

     

   myURI = uri.ToString();

                     

   System.IO.FileStream fs = new 
System.IO.FileStream(myURI,System.IO.FileMode.Open,System.IO.FileAccess.Read,System.IO.FileShare.ReadWrite);

     

   log4net.Config.XmlConfigurator.Configure(fs);

                     

   log.Debug("Logging started.");

                     

     

   Thanks,

   Robin

   

  







Reply via email to