net-commons / common-logging

A portable logging abstraction for .NET
http://net-commons.github.io/common-logging
Apache License 2.0
649 stars 203 forks source link

Common.Logging.Log4Net208 & .NET Core 2.0 problem ? #167

Open NicolasPerego opened 6 years ago

NicolasPerego commented 6 years ago

Hi there,

I can't find a way to make theses package works in a .NET Core 2.0 web project.

appsettings.json :

},
  "Common": {
    "factoryAdapter": {
      "Type": "Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net208",
      "Arguments": {
        "configType": "FILE",
        "configFile": "~/log4net.config"
      }     
    }
  }

Startup.cs :

var logConfiguration = _appConfiguration.GetSection("Common").Get<LogConfiguration>();
api.Config.LoggerFactoryAdapter = new Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter(logConfiguration.FactoryAdapter.Arguments);

Each time I have an exception at the last line, because the Common.Logging.Log4Net129.Logging.Log4Net.Log4NetLoggerFactoryAdapter.cs seems to call methods that doesn't exists anymore in log4net :

If I understand correctly, those two methods have been excluded from log4net 208 (maybe before ?) if the framework used is above netstandard 1.3 : https://github.com/apache/logging-log4net/blob/master/src/Config/XmlConfigurator.cs (lines 319 & 816).

Am I missing something here ?

NicolasPerego commented 6 years ago

The problem seems to be with log4net, which did not adapt to NETSTANDARD 2.0, I don't know wich side will be easier to fix ?

pedromfonsecapt commented 5 years ago

Is there any feedback regarding this? I'm still facing this issue and would like to have a possible solution.

EDIT: I was checking and I've noticed an EXTERNAL configType option in appsettings.json. Maybe that's what I need since I've configured log4net already in my app. Will give it a try tomorrow.