Introduction

Log4net is an Open Source utility used for log/report statements to various kinds of output targets (text file, email, database, event viewer etc.): http://logging.apache.org/. It can be a very handy utility for application instrumentation purposes.

Configuring Log4net

Step 1: Add a reference of Log4net.dll to the project.

Step 2: Add Global.asax to the project, if not already added. In the "Application_Start" event of global.asax, add the following code:

log4net.Config.XmlConfigurator.Configure();

Step 3: In the web.config file, under Configuration->Configsections, add the following section: