We recently moved our ASP.NET Web API application to ASP.NET Core. We use log4net for logging - RollingFileAppenders and an ADONetAppender. We wanted to continue using log4net to minimize code changes but also use the middleware logging framework. So we were happy to find a Nuget package with an adapter for log4net (https://github.com/huorswords/Microsoft.Extensions.Logging.Log4Net.AspNetCore)
This works well for the file appenders. But for the DB appender, we do not have the connection string in the config file for security reasons. We used to add it at runtime (see Log4NET AdoNetAppender connection string reference).
I've tried creating my own LoggerFactory in which I use the same technique. But it seems like its "too late" to change the connection string. The repository appears to be updated, but log4net fails to write to the DB. (If I include the same connection string in the config file it works correctly).
Has anyone run into this issue? And solved it?