Using Log4net in your web apps
by Steven Ng on March 20, 2007
Log4net is part of the Apache Logging Services Project. It’s a tool to help ASP.net developers log message to a text file, xml file, email or database.
- Add
log4net.Config.XmlConfigurator.Configure();to Global.asax in theApplication_Startmethod. - In your code-behind or BasePage.cs, declare
protected static readonly ILog logger =
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - Web.config has all the magic.
, , and
To be continued…
One comment
Very helpful.
by Scott on July 18, 2007 at 6:22 pm. #