Here there is a great description of how to set up log4net.
So remember to make it work for a webapp, using configurations from a file you have to add fallowing line in the global.asax.cs inside Application_Start():
log4net.Config.XmlConfigurator.Configure()
If you specify the configuration in a different file then web.config then you have to add the fallowing attributes to the class (for a webapp in the global.asax.cs)
// We want this assembly to have a seperate logging repository
to the
// rest of the application. We will configure this repository
seperatly.
[assembly: log4net.Config.Repository("Test")]
// Configure logging for this assembly using the
'Test.dll.log4net' file
[assembly: log4net.Config.XmlConfigurator
(ConfigFileExtension = "log4net", Watch = true)]
No comments:
Post a Comment