title: NLog is not writing to database table
body: <p>This is my NLog Config file.</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" ?&gt;
  &lt;nlog autoReload="true" throwExceptions="true"  internalLogLevel="Debug" internalLogToConsole="true"
       internalLogFile="c:\\temp\\nlog.txt" 
        &gt;
  
    &lt;targets&gt;
      &lt;!--Useful for debugging--&gt;
      &lt;target name="consolelog" type="ColoredConsole"
      layout="${date:format=HH\:mm\:ss}|${level}|${stacktrace}|${message}" /&gt;
  
      &lt;target name="filelog" type="File" fileName="c:\\temp\\nlog1.txt"
      layout="${date}: ${message}" /&gt;
  
      &lt;target name="eventlog" type="EventLog" source="My App" log="Application"
      layout="${date}: ${message} ${stacktrace}" /&gt;
  
      &lt;target name="databaselog" type="Database"&gt;
  
        &lt;dbProvider&gt;sqlserver&lt;/dbProvider&gt;
  
        &lt;!-- database connection parameters --&gt;
        &lt;!-- alternatively you could provide a single 'connectionstring' parameter --&gt;
        &lt;connectionString&gt;Data Source=.\SQLEXPRESS;Initial Catalog=SnSolutions;User Id=sa;Password=test@1234@;&lt;/connectionString&gt;
        &lt;!--&lt;add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MyTest;User Id=mytest;Password=mytest123;" providerName="System.Data.SqlClient" /&gt;--&gt;
  
        &lt;commandText&gt;
          insert into NLog_Error ([time_stamp],[level],[host],[type],1,[logger],[message],[stacktrace],[allxml]) values(@time_stamp,@level,@host,@type,@source,@logger,@message,@stacktrace,@allxml);
        &lt;/commandText&gt;
  
        &lt;parameter name="@time_stamp" layout="${date}" /&gt;
        &lt;parameter name="@level" layout="${level}" /&gt;
        &lt;parameter name="@host" layout="${machinename}" /&gt;
        &lt;parameter name="@type" layout="${exception:format=type}" /&gt;
        &lt;parameter name="@source" layout="${callsite:className=true:fileName=false:includeSourcePath=false:methodName=false}" /&gt;
        &lt;parameter name="@logger" layout="${logger}" /&gt;
        &lt;parameter name="@message" layout="${message}" /&gt;
        &lt;parameter name="@stacktrace" layout="${exception:stacktrace}" /&gt;
        &lt;parameter name="@allxml" layout="${web_variables}" /&gt;
  
      &lt;/target&gt;
  
    &lt;/targets&gt;
  
    &lt;rules&gt;
      &lt;!--
   &lt;logger name="*" minlevel="Fatal" writeTo="eventlog" /&gt;
   --&gt;
      &lt;logger name="*" minlevel="Info" writeTo="filelog" /&gt;
      &lt;logger name="*" minlevel="Info" writeTo="databaselog" /&gt;
    &lt;/rules&gt;
  
  &lt;/nlog&gt;
  </code></pre>
  
  <p>This is my NLogLogger Class</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class NLogLogger 
  {
      private readonly Logger _logger;
  
      public NLogLogger(Logger logger)
      {
  
          _logger = logger;
      }
  
      public NLogLogger()
      {
          StackFrame frame = new StackFrame(1, false);
  
          _logger = LogManager.GetLogger(frame.GetMethod().DeclaringType.FullName);
  
      }
  
      public void Trace(string message)
      {
          _logger.Trace(message);
      }
  
      public void Debug(string message)
      {
          _logger.Debug(message);
      }
  
      public void Info(string message)
      {
          _logger.Info(message);
      }
  
      public void Warn(string message)
      {
          _logger.Warn(message);
      }
  
      public void Error(string message)
      {
          _logger.Error(message);
      }
  
      public void Fatal(string message)
      {
          _logger.Fatal(message);
      }
  }
  </code></pre>
  
  <p>which I am trying to use in the following way.</p>
  
  <pre class="lang-cs prettyprint-override"><code>NLogLogger logger = new NLogLogger();
  
  logger.Info("We're on the Index page for Activities");
  </code></pre>
  
  <p>But not able to see any records in the DB nor any error in the File System.</p>
  
  <p>Please let me know which is the part I am missing.</p>
  
  <p>Thanks in advance.</p>