title: NLog MySql .Net Core 3.0 logging not saving to database
body: <p>I have setup NLog on my project that will save the logging to my audit database (separate from the default database). However, it is failing to write to the database. I have a console logger target as well and that is logging as expected. No errors are shown or given. It merely fails to write to the database.</p>
  
  <p>I have tried various methods provided from google, but none seemed to have worked. I have also tried using NLogBuilder to configure the config for that specific controller but still, it doesn't write to the database</p>
  
  <p><strong>nlog.config file:</strong></p>
  
  <pre><code>&lt;configSections&gt;  
    &lt;section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" /&gt;  
  &lt;/configSections&gt; 
  &lt;nlog internalLogLevel="Trace"&gt;
    &lt;targets&gt;
      &lt;target name="ConsoleLogger" type="Console" 
        layout="${longdate}|${level:uppercase=true}|${logger}|${message}"/&gt;
      &lt;target name="DatabaseLog" type="Database"&gt;
        &lt;commandtext&gt;
          INSERT INTO Logs 
          (LogDate, LogLevel, Message, Exception) 
          VALUES 
          (@log_date, @log_level, @message, @exception)
        &lt;/commandtext&gt;
  
        &lt;parameter name="@log_date" 
                   layout="${log_date}" 
                   dbType="DateTime"/&gt;
        &lt;parameter name="@thread" 
                   layout="${thread}" 
                   dbType="String"
                   size="255"/&gt;
        &lt;parameter name="@log_level" 
                   layout="${log_level}"
                   dbType="String"
                   size="20" /&gt;
        &lt;parameter name="@logger" 
                   layout="${logger}"
                   dbType="String"
                   size="250" /&gt;
        &lt;parameter name="@message" 
                   layout="${message}"
                   dbType="String"
                   size="4000" /&gt;
        &lt;parameter name="@exception" 
                   layout="${exception}"
                   dbType="String"
                   size="4000" /&gt;
  
        &lt;dbProvider&gt;MySql.Data.MySqlClient.MySqlConnection, MySql.Data&lt;/dbProvider&gt;
        &lt;connectionString&gt;User Id=username;Password=password;Host=localhost;Database=audit_database;TreatTinyAsBoolean=false&lt;/connectionString&gt;
      &lt;/target&gt;
    &lt;/targets&gt;
    &lt;rules&gt;
      &lt;logger name="*" minlevel="Debug" maxlevel="Fatal" writeTo="ConsoleLogger,DatabaseLog" /&gt;
    &lt;/rules&gt;
  &lt;/nlog&gt;
  </code></pre>
  
  <p><strong>Controller method:</strong></p>
  
  <pre><code>public static Logger _logger = LogManager.GetCurrentClassLogger(typeof(ActionerController));
  
  _logger.Info("text");
  </code></pre>
  
  <p><strong>Main.cs</strong></p>
  
  <pre><code>public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
    Host.CreateDefaultBuilder(args)
      .ConfigureLogging(logging =&gt;
      {
        logging.ClearProviders();
        logging.AddNLog();
      }).ConfigureAppConfiguration((hostingContext, config) =&gt;
      {
        config
          .AddJsonFile($"environment-mount/appsettings.json", optional: true)
          .AddEnvironmentVariables();
      }).ConfigureWebHostDefaults(webBuilder =&gt;
      {
        webBuilder.UseStartup&lt;Startup&gt;();
      });
  </code></pre>