title: When using Log4Net to log to database, field names appearing instead of values
body: <p>I am having problems logging to my database using Log4Net.<br>
  I am not quite sure what to make of my results. I keep getting the field name when I should be getting the values of the fields. </p>
  
  <p>The program is a SystemTray utility. I have set Log4Net up as follows. </p>
  
  <p>In the Assembly:</p>
  
  <pre class="lang-cs prettyprint-override"><code>[assembly: log4net.Config.XmlConfigurator(Watch = true)]
  </code></pre>
  
  <p>In the Program.cs:</p>
  
  <pre class="lang-cs prettyprint-override"><code> private static readonly ILog log = LogManager.GetLogger(typeof(Program));
  
          [STAThread]
          static void Main()
          {
              log4net.Config.XmlConfigurator.Configure();
  </code></pre>
  
  <p>In the calling class:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class HostManager
  {
  
      #region constants
  
          protected static readonly ILog log = LogManager.GetLogger(typeof(HostManager));
  
          ...
  
          // Inside an event method:
  
            try
              {
  
                  log.Info(new Log
                  {   
                      CreateDate = DateTime.Now.ToString(),
                      SystemUpTime = FormatUpTime(_states.TimeFromStart),
                      EmotivType = "boredom",
                      EmotivValue = _states.AffectivEngagementBoredomScore.ToString(),
                      EventTimer = _eventTimer,
                      SubEventTimer = _subEventTimer
                  });
  
  
              }
  </code></pre>
  
  <p>The Log class is just a bunch of getter and setters of type string. </p>
  
  <p>And, my app.config file with the log4net settings: </p>
  
  <pre class="lang-xml prettyprint-override"><code> &lt;log4net&gt;
      &lt;appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender"&gt;
  
        &lt;bufferSize value="1"/&gt;
        &lt;connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/&gt;
        &lt;connectionString value="Data Source=localhost; Initial Catalog=[MyDatabase]; Integrated Security=True;"/&gt;
  
        &lt;commandText value="INSERT INTO Session ([CreateDate], [SystemUpTime], [EmotivType], [EmotivValue], [EventTimer], [SubEventTimer]) 
                     VALUES (@createdate, @systemuptime, @emotivtype, @emotivvalue, @eventtimer, @subeventtimer)"/&gt;
  
        &lt;parameter&gt;
          &lt;parameterName value="@createdate"/&gt;
          &lt;dbType value="DateTime"/&gt;
          &lt;layout type="log4net.Layout.RawTimeStampLayout" /&gt;
        &lt;/parameter&gt;
  
         &lt;parameter&gt;
          &lt;parameterName value="@systemuptime"/&gt;
          &lt;dbType value="DateTime"/&gt;
          &lt;layout type="log4net.Layout.RawTimeStampLayout"/&gt;
        &lt;/parameter&gt;
  
       &lt;parameter&gt;
      &lt;parameterName value="@emotivtype" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="50" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
      &lt;conversionPattern value="%emotivtype" /&gt;
    &lt;/layout&gt;
    &lt;/parameter&gt;
  
    &lt;parameter&gt;
      &lt;parameterName value="@emotivvalue"/&gt;
      &lt;dbType value="String"/&gt;
      &lt;size value="255"/&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%emotivvalue"/&gt;
      &lt;/layout&gt;
    &lt;/parameter&gt;
  
        &lt;parameter&gt;
          &lt;parameterName value="@eventtimer"/&gt;
          &lt;dbType value="DateTime"/&gt;
          &lt;layout type="log4net.Layout.RawTimeStampLayout"/&gt;
        &lt;/parameter&gt;
  
        &lt;parameter&gt;
          &lt;parameterName value="@subeventtimer"/&gt;
          &lt;dbType value="DateTime"/&gt;
          &lt;layout type="log4net.Layout.RawTimeStampLayout"/&gt;
        &lt;/parameter&gt;
  
      &lt;/appender&gt;
      &lt;root&gt;
        &lt;level value="ALL"/&gt;
        &lt;appender-ref ref="AdoNetAppender"/&gt;
      &lt;/root&gt;
    &lt;/log4net&gt;
  </code></pre>
  
  <p>The result is that the %emotivtype and %emotivalue always receive the field names: </p>
  
  <pre><code>ID  CreateDate  SystemUpTime    EmotivType  EmotivValue EventTimer  SubEventTimer
  13547   17:06:56.787    17:06:56.787    emotivtype  emotivvalue 17:06:56.787    17:06:56.787
  </code></pre>
  
  <p>This seems like such a silly, fixable thing but it escapes me. Any suggestions? Thanks.</p>