title: Common logging log4net file-watch
body: <p>I want to use a Common.logging and log4net on project wrapper, i created a log4net.config file on my logging project and i configured my web.config file but i got an exception when i try to log anything (error, info, etc). I thought the problem is in the web.config file but i checked out and i don't see anything wrong.</p>
  
  <p>The exception error is </p>
  
  <blockquote>
    <p>An error occurred creating the configuration section handler for
    common/logging: Unable to create type
    'Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter,
    Common.Logging.Log4Net</p>
  </blockquote>
  
  <p>DLL's</p>
  
  <pre><code>Common.Logging.2.0.0
  Common.Logging.Log4Net.2.0.1
  log4net.1.2.10
  </code></pre>
  
  <p>Wrapper class</p>
  
  <pre><code>using System;
  using System.Diagnostics;
  using Common.Logging;
  using System.Reflection;
  
  namespace LoggerL
  {
      public class Logger
      {
          private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  
          //static Logger()
          //{
            //  XmlConfigurator.Configure();
          //}
  
          public static void Info(string msg = "")
          {
              var method = new StackFrame(1).GetMethod();
              var name = method.DeclaringType.FullName + "." + method.Name + "(";
  
              foreach (var item in method.GetParameters())
              {
                  name += item.ParameterType.Name + " " + item.Name + ", ";
              }
  
              name = name.Substring(0, name.Length - 2) + ")" + " " + msg;
  
              log.Info(name);
          }
  
          public static void Error(Exception ex)
          {
              var method = new StackFrame(1).GetMethod();
              var name = method.DeclaringType.FullName + "." + method.Name + "(";
  
              foreach (var item in method.GetParameters())
              {
                  name += item.ParameterType.Name + " " + item.Name + ", ";
              }
  
              name = name.Substring(0, name.Length - 2) + ")";
  
              name += ")";
  
              log.Error(name, ex);
          }
      }
  }
  </code></pre>
  
  <p>web.config file</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="common"&gt;
        &lt;section name="logging"
                 type="Common.Logging.ConfigurationSectionHandler, Common.Logging" /&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
    &lt;common&gt;
      &lt;logging&gt;
        &lt;factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net"&gt;
          &lt;arg key="configType" value="FILE-WATCH" /&gt;
          &lt;arg key="configFile" value="~/bin/log4net.config" /&gt;
        &lt;/factoryAdapter&gt;
      &lt;/logging&gt;
    &lt;/common&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>log4net.config file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/&gt;
    &lt;/configSections&gt;
  
    &lt;log4net&gt;
      &lt;root&gt;
        &lt;level value="INFO" /&gt;
        &lt;appender-ref ref="DatabaseAppender" /&gt;
      &lt;/root&gt;
  
      &lt;appender name="DatabaseAppender" type="log4net.Appender.AdoNetAppender"&gt;
        &lt;bufferSize value="1" /&gt;
  
        &lt;connectionType value="System.Data.SqlClient.SqlConnection, 
                                    System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
        &lt;connectionString value="data source=MyServer; initial catalog=MyDB;integrated security=false;
                                            persist security info=True;User ID=MyUser;Password=MyPass" /&gt;
        &lt;commandText
            value="INSERT INTO [Log]
                            ([Date],[Thread],[Level],[Logger], [Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)" /&gt;
        &lt;parameter&gt;
          &lt;parameterName value="@log_date" /&gt;
          &lt;dbType value="DateTime" /&gt;
          &lt;layout type="log4net.Layout.RawTimeStampLayout" /&gt;
        &lt;/parameter&gt;
        &lt;parameter&gt;
          &lt;parameterName value="@thread" /&gt;
          &lt;dbType value="String" /&gt;
          &lt;size value="255" /&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
            &lt;conversionPattern value="%thread" /&gt;
          &lt;/layout&gt;
        &lt;/parameter&gt;
        &lt;parameter&gt;
          &lt;parameterName value="@log_level" /&gt;
          &lt;dbType value="String" /&gt;
          &lt;size value="50" /&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
            &lt;conversionPattern value="%level" /&gt;
          &lt;/layout&gt;
        &lt;/parameter&gt;
        &lt;parameter&gt;
          &lt;parameterName value="@logger" /&gt;
          &lt;dbType value="String" /&gt;
          &lt;size value="255" /&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
            &lt;conversionPattern value="%logger" /&gt;
          &lt;/layout&gt;
        &lt;/parameter&gt;
        &lt;parameter&gt;
          &lt;parameterName value="@message" /&gt;
          &lt;dbType value="String" /&gt;
          &lt;size value="4000" /&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
            &lt;conversionPattern value="%message" /&gt;
          &lt;/layout&gt;
        &lt;/parameter&gt;
        &lt;parameter&gt;
          &lt;parameterName value="@exception" /&gt;
          &lt;dbType value="String" /&gt;
          &lt;size value="2000" /&gt;
          &lt;layout type="log4net.Layout.ExceptionLayout" /&gt;
        &lt;/parameter&gt;
      &lt;/appender&gt;
    &lt;/log4net&gt;
  &lt;/configuration&gt;
  </code></pre>