2010年11月19日星期五

Log4net.config

the steps to let Log4Net run in ASP.Net 1.1 are:
  1. writing config section for Log4Net in web.config file
  2. insert logging code in conponents and web page code-behind
  3. At website's AssemblyInfo.cs or .vb file, add "<Assembly: log4net.Config.DOMConfigurator(Watch:=True)>" for VB.net or "[assembly: log4net.Config.XmlConfigurator(Watch=true)]" for C# to enable Log4Net to Log stuffs.
  4. compile the web application and run.
By searching and refering the posts here and here and here, comes out that the configuration way in ASP.NET 2.0 is little bit different, as follows:
  1. writing config section for Log4Net in web.config file
  2. insert logging code in conponents and web page code-behind
  3. At Global.asax file, under Application_Start event, add "log4net.Config.XmlConfigurator.Configure()" to trigger Log4Net to log stuffs.
  4. compile the web application and run.
By doing the settings above, Log4Net started to output logs in my ASP.Net 2.0 application.

没有评论: