Thanks for the article, Thomas. I use log4net for a couple of years, with log4stash appender to write logs to Elasticsearch. It works pretty well, but I miss the support of native Microsoft.Extensions.Logging.ILogger in my codebase - we use our own wrapper around log4net.ILog interface.
Can log4net be used through native Microsoft.Extensions.Logging.ILogger interface? If so, what should I do with my custom properties which I add to almost every log message?
Not sure exactly what you mean there. You want to use Microsoft.Extensions.Logging.ILogger as the main interface for logging messages. And then configure log4net as the implementation for that and control were to persist the log messages with log4net config?
Yes, my goal is to use Microsoft.Extensions.Logging.ILogger everywhere in my solution. I would rather use Microsoft's interface ILogger than my own wrapper or directly log4net interface. Unfortunately, I haven't found any existed Microsoft.Extensions.Logging.ILogger implementation that uses log4net or any kind of adapter. Maybe I'm using old log4net nuget package and now they implement Microsoft's ILogger interface.
Thanks for the article, Thomas. I use log4net for a couple of years, with log4stash appender to write logs to Elasticsearch. It works pretty well, but I miss the support of native Microsoft.Extensions.Logging.ILogger in my codebase - we use our own wrapper around log4net.ILog interface.
Can log4net be used through native Microsoft.Extensions.Logging.ILogger interface? If so, what should I do with my custom properties which I add to almost every log message?
Not sure exactly what you mean there. You want to use Microsoft.Extensions.Logging.ILogger as the main interface for logging messages. And then configure log4net as the implementation for that and control were to persist the log messages with log4net config?
Yes, my goal is to use Microsoft.Extensions.Logging.ILogger everywhere in my solution. I would rather use Microsoft's interface ILogger than my own wrapper or directly log4net interface. Unfortunately, I haven't found any existed Microsoft.Extensions.Logging.ILogger implementation that uses log4net or any kind of adapter. Maybe I'm using old log4net nuget package and now they implement Microsoft's ILogger interface.
You could use a NuGet package like this one: nuget.org/packages/Microsoft.Exten....
😳how could I missed that?
Thank a lot!