The built-in logging cannot log to file/database. I found the following link however it's for Asp>net core.
https://github.com/NLog/NLog.Web/wiki/Getting-started-with-ASP.NET-Core-(csproj---vs2017)
How to use NLog in the .Net core console application?