NickCraver/StackExchange.Exceptional

Not logging to mysql database

kellielellie1 opened this issue · 1 comments

I updated the StackExchange.Exceptional from 2.2.17 to 2.2.23 due to a reference error for mysql.

I have yet to be successful at logging an entry to the exceptions table in mysql. I have tried with both the default table name "Exceptions" and a custom table name "ExceptionLog" which includes adding an entry in appsettings.json for "TableName": "ExceptionLog".

The StackExchange.Exceptional error page shows on the UI, just no logging.

I am using ASP.NET Core 3.1 and have set up using the following walkthrough:
Setup for ASP.NET Core

My Startup class has:

            services.AddExceptional(Configuration.GetSection("Exceptional"), settings =>
            {
                settings.UseExceptionalPageOnThrow = _currentEnvironment.IsDevelopment();
            });

and

app.UseExceptional();

My entry in appsettings.json is:

"Exceptional": {
    "Store": {
      "ApplicationName": "Helpinghand",
      "Type": "MySQL",
      "ConnectionString": "server=localhost;port=3306;user=root;password=[******];database=[name.name.com.au];",
      "TableName": "ExceptionLog"
    }
},

Im just throwing an exception on my HomeController Index action to test with:

        public async Task<IActionResult> Index()
        {
            throw new Exception("Oops.");
            return View();
         }

I got it working by adding "Allow User Variables=True" to the connection string

"Exceptional": {
"Store": {
"ApplicationName": "Helpinghand",
"Type": "MySQL",
"ConnectionString": "server=localhost;port=3306;user=root;password=[blah];database=[blah];Allow User Variables=True",
"TableName": "ExceptionLog"
}
},

Hope that helps someone else