title: Log4Net Issue with .Net 4.0
body: <p>I have looked for a "fix" to my issue for a few days not and have gotten nowhere. Basically what is happening is that I have an application that writes to a database and sends an email via log4Net. </p>
  
  <p>Here is where I initialize my log object:</p>
  
  <pre><code>private static readonly log4net.ILog log;
  #endregion
  
  static PTSentryService()
  {
      // Initialize log4net.
      log4net.Config.XmlConfigurator.Configure();
      log = log4net.LogManager.GetLogger(typeof(PTSentryService));        
  }
  </code></pre>
  
  <p>I then use the LogHelper class to grab the configuration information, below is what I have in my Web.Config:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;log4net&gt;
  &lt;appender name="ADONetAppender_SqlServer" 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=ServerName;Initial Catalog=EventLog;Trusted_Connection=no;User ID=EventLogAdmin;Password=EVLA%dtm" /&gt;
    &lt;commandText value="INSERT INTO EventLog ([TimeStamp],[SeverityLevel],[LoggerName],[Environment],[ApplicationName],[ApplicationPath],[ServerName],[Message],[ExceptionData]) VALUES (@TimeStamp,@SeverityLevel,@LoggerName,@Environment,@ApplicationName,@ApplicationPath,@ServerName,@Message,@ExceptionData)" /&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@TimeStamp" /&gt;
      &lt;dbType value="DateTime" /&gt;
      &lt;layout type="log4net.Layout.RawTimeStampLayout" /&gt;
    &lt;/parameter&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@SeverityLevel" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="10" /&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="@LoggerName" /&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="@Environment" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="4" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%property{EnvironmentName}" /&gt;
      &lt;/layout&gt;
    &lt;/parameter&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@ApplicationName" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="128" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%property{AppName}" /&gt;
      &lt;/layout&gt;
    &lt;/parameter&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@ApplicationPath" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="255" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%property{AppPath}" /&gt;
      &lt;/layout&gt;
    &lt;/parameter&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@ServerName" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="255" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%property{log4net:HostName}" /&gt;
      &lt;/layout&gt;
    &lt;/parameter&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@Message" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="-1" /&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="@ExceptionData" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="-1" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%property{exceptionDetails}" /&gt;
      &lt;/layout&gt;
    &lt;/parameter&gt;
  &lt;/appender&gt;
  
  &lt;appender name="SmtpAppender" type="log4net.Appender.SmtpAppender"&gt;
    &lt;to value="Mailbox@group.com" /&gt;
    &lt;from value="Mailbox@group.com" /&gt;
    &lt;subject value="(LOCL) PT Sentry" /&gt;
    &lt;smtpHost value="group.com" /&gt;
    &lt;bufferSize value="1" /&gt;
    &lt;lossy value="false" /&gt;
    &lt;threshold value="ERROR" /&gt;
    &lt;layout type="log4net.Layout.PatternLayout"&gt;
      &lt;conversionPattern value="%utcdate [%thread] %-5level %logger [%property{log4net:HostName}] - %message%newline%newlineException details:%newline%property{exceptionDetails}" /&gt;
    &lt;/layout&gt;
  &lt;/appender&gt;
  
  &lt;root&gt;
    &lt;level value="INFO" /&gt;
    &lt;appender-ref ref="ADONetAppender_SqlServer" /&gt;
    &lt;appender-ref ref="SmtpAppender" /&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p></p>
  
  <p>What occurs is that all the properties in the <code>ILog</code> object (isErrorEnabled, etc) are all false. I know this is due to the config not being loaded properly, but this is a copy paste job from a .Net 3.5 project that I know works. Are there changes that I need to make to accommodate 4.0?</p>
  
  <p>Any info would be excellent, thanks!</p>