I am working on ASP.NET5 Project where I am using Microsoft.Extensions.Logging as logging framework. Here I want to provide the different options for logging.The User can select logging into a text file or Database(SQL Server) itself.
I know how to do logging in the-the text file. But How I can configure Microsoft.Extensions.Logging to log data in SQL Server.
Any help will be really appreciated.
Take a look at Damienbod's blog at https://damienbod.com/2016/08/17/asp-net-core-logging-with-nlog-and-microsoft-sql-server/.
It comes with a sample project that writes to both text and database.
Update ConnectionStrings for NLogDb in appsettings.json to
"Data Source=(localdb)\mssqllocaldb;Initial Catalog=AspNetCoreNlog;Integrated Security=True;"
It will takes about 10 minutes to setup and run.