You need to use the XMLConfigurator to tell log4net where the file is.
Easiest place to do this in the Application_Start event handler.

In VB...

   'point it to the right place to find the config file
   Dim ConfigFile As String = Server.MapPath("~") & "\config\log4Net.config"
   XmlConfigurator.ConfigureAndWatch(New System.IO.FileInfo(ConfigFile))

In C#

    //point it to the right place to find the config file
   string ConfigFile = Server.MapPath("~") & @"\config\log4Net.config";
   XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(ConfigFile));

HTH,

Dean Fiala

Chief Technology Officer
Celadon Laboratories, Inc.
http://www.celadonlabs.com






-----Original Message-----
From: pvphuc [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 11, 2006 4:07 AM
To: [email protected]
Subject: Problem with Log4Net.config file.


I create a file : Log4net.config in my project for Log4net configuration (I
do not want to write them in Web.config) But I can not write to log file
(for example : C:\\Log_file.txt).

(If I config in Web.config, Log_file.txt is updated)

Please tell me how I can use external Log4Net.config instead using
Web.Config.
(I am using ASP.Net 2.0)

Thanks in advance!
--
View this message in context:
http://www.nabble.com/Problem-with-Log4Net.config-file.-tf2792725.html#a7791
449
Sent from the Log4net - Users mailing list archive at Nabble.com.




Reply via email to