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 Ismail Mayat <i....@kudos-idd.com> on 2004/08/12 13:29:38 UTC

log4net with asp.net

Support,

Version : log4net-1.2.0-beta8
Project type : ASP.NET project
When i attempt to do logging in asp.net project a log is not created, I have
the following code in a c# class that is called by asp.net page
private static readonly ILog Logger =
LogManager.GetLogger(typeof(ContentExporterController));
		/// <summary>
		/// The default constructor method.
		/// </summary>
		public ContentExporterController()
		{
			//init the logger
			
			DOMConfigurator.Configure(new
System.IO.FileInfo(System.Environment.CurrentDirectory  + "\\" + "xml" +
"\\" + "log4j_exporter.xml")); //this gives me D:\temp
			
			Logger.Debug("Successfully initialised");
		}
When I step through code and i get to DOMConfigurator line the actual
directory returned is D:\temp\xml\log4j_exporter.xml, the xml file contains
the following
<?xml version="1.0" encoding="UTF-8" ?> 
- <log4net> 
- <appender name="RollingFile" type="log4net.Appender.RollingFileAppender"> 
<file value="log/ContentExporter.log" /> 
<appendToFile value="false" /> 
<maximumFileSize value="1000KB" /> 
<maxSizeRollBackups value="2" /> 
- <layout type="log4net.Layout.PatternLayout"> 
<conversionPattern value="%p >> %t %c - %m%n" /> 
</layout> 
</appender> 
- <root> 
- <!-- 
 
			the levels are 
			ALL 
			DEBUG 
			INFO 
			WARN 
			ERROR 
			FATAL 
			OFF 
		if you set to info then all statements below and including
info are logged
		
--> 
<level value="DEBUG" /> 


<appender-ref ref="RollingFile" /> 
</root> 
</log4net>
The xml dir and log dir are present in the d:\temp dir and have been opened
to the aspnet account and given read/write access.  I get no errors and no
log file.

Thanks 
Regards
Ismail