title: How to initialize .net Core ILogger or ILoggerFactory from .NET Framework and inject to a constructor in Class library built in .Net Core
body: <p>I am consuming a Class Library which is built using .NET Core. The Library has only one public class with a constructor accepting ILoggerFactory and another overloaded constructor accepting ILogger. But I am consuming this library in a console app built using .NET Framework 4.7. My console app uses Log4Net for logging. But I need to inject the instance of ILogger or ILoggerFactory so that the class library log's error based on my log.config settings.</p>
  
  <p>I tried as below</p>
  
  <p>ILogger logger = new LoggerFactory().CreateLogger();
  var contentManager = new ContentManager(logger);</p>
  
  <p>But I don't know how to pass the Log4Net instance to the LoggerFactory.</p>
  
  <pre><code>private static ILog _log = LogManager.GetLogger(typeof(Program));
  static void Main(string[] args)
  {
     ILogger logger = new LoggerFactory().CreateLogger&lt;ContentManager&gt;();
     var contentManager = new ContentManager(logger);
     contentManager.Run();
  }
  </code></pre>
  
  <p>I don't find anything getting logged and ContentManager doesn't throw any exceptions. I know that the ILogger instance doesn't know anything about Log4Net from my console app, how I need to pass the Log4Net instance? Need help on this.</p>