First of all you neet to add the following in the web.config or app.config.
<configuration>
<configsections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configsections>
</configuration>
Secondly you need to specify what appender to use, also in the config file.
<log4net>
<root>
<level value="ALL" />
<appender-ref ref="MyAppender" />
</root>
<appender name="MyAppender" type="SomeNamespace.MyAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionpattern value="%date [%thread] %level %logger - %message%newline" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<levelmin value="INFO" />
<levelmax value="FATAL" />
</filter>
</appender>
</log4net>
Different appenders have different configs.
Finally, here is an example on how to use it all from code.
using System;
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
namespace ConsoleApplication7
{
class Program
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger (System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
static void Main(string[] args)
{
log.Info("Info logging");
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
Hope that helps.