Steps to add log4net in your .net project?
ADDING DLL
Just place the 'log4net.dll' in your project folder
In Solution Explorer, Right click on the 'References' Folder
and click 'Add References'
Now choose the log4net.dll under the BROWSE tab
ADDITION in WEB.CONFIG/APP.CONFIG
Add the following xml thing in your config file, under element
ADDITION in ASSEMBLYINFO.cs
In Solution Explorer, under Properties folder, you can find the AssemblyInfo.cs
Just open it & Add the following @ very last line
ADDING SOURCE CODE
Now coding part,
Just add the following namespace in your .cs file,
Initialize the below statement in your method
Inside your method, Start logging
Tats it..
Happy Coding
ADDING DLL
Just place the 'log4net.dll' in your project folder
In Solution Explorer, Right click on the 'References' Folder
and click 'Add References'
Now choose the log4net.dll under the BROWSE tab
ADDITION in WEB.CONFIG/APP.CONFIG
Add the following xml thing in your config file, under
ADDITION in ASSEMBLYINFO.cs
In Solution Explorer, under Properties folder, you can find the AssemblyInfo.cs
Just open it & Add the following @ very last line
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
ADDING SOURCE CODE
Now coding part,
Just add the following namespace in your .cs file,
using log4net; using log4net.Config;
Initialize the below statement in your method
private static log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
Inside your method, Start logging
logger.Info(" ** GoogleDotnet.Blogspot.com - Logging Begins ** ");
Tats it..
Happy Coding