1

While using C# Common.Logging, the current logging set up is such that the _logger is declared as below in the beginning of every class that the _logger is used.

private static readonly ILog _logger = LogManager.GetCurrentClassLogger();

Is this the correct way to do it? Is there a better alternative?

Chris Marisic
  • 32,487
  • 24
  • 164
  • 258
Sartorial
  • 173
  • 1
  • 8

1 Answers1

0

This is a correct way to do it. There are certainly other correct ways to do it. You could have the logger injected into this class in its constructor, for example. That would make it easier for you to unit test log messages, if you're into that kind of thing.

StriplingWarrior
  • 151,543
  • 27
  • 246
  • 315