Monday, October 29, 2012

Enable log4net read from Configuration file for windows services

The logging component for .Net one of greatest is log4net.It is very simple, powerful, and extensible.
We can use for the windows, console or asp.net web application and can setting syntax in configuration file (App.config, Web.config).

When using log4net for windows service application you should

Add this line in assembly information file (AssemblyInfo.cs), it will read from your App.config within log4net section.

[assembly: log4net.Config.XmlConfigurator(Watch = true)]

The example in App.config