title: ASP.NET Core Web API Logging from a Static Class
body: <p>I'm logging just fine using dependency injection on my controllers, now I need to log something <strong>from</strong> a static class.</p>
  
  <p>How can I log <strong>from</strong> a static class? </p>
  
  <p>I can't use dependency injection because it's static and I can't just pass in an existing logger object to the static class because it would have the wrong name of class in the log file.</p>
  
  <p>In other words how can I get a logger from the loggerfactory inside my static class?</p>
  
  <p>I came across a similar question and they pointed to an article on a loggerfactory in a static class but that doesn't actually work as I can't get a new logger from it because it won't accept a static class as the parameter: </p>
  
  <p>"Static types cannot be used as type arguments"</p>