You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by "McAninch, Robin J" <mc...@UPMC.EDU> on 2007/02/01 19:01:25 UTC

Configuration problem (locking files)

Hi

 

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