Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NicolasPerego opened this issue Jan 16, 2018 · 2 comments
Open

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

NicolasPerego opened this issue Jan 16, 2018 · 2 comments

Comments

@NicolasPerego
Copy link

NicolasPerego commented Jan 16, 2018

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 :

  • log4net.Config.XmlConfigurator.Configure(new FileInfo(configFile));
  • log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(configFile));

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
Copy link
Author

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
Copy link

pedromfonsecapt commented Dec 12, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants