ASP.NET MVC (2) log4net logging pattern

What is the best registration template for asp.net mvc 2 using log4net? When I have to initialize the logger, how do I access the log instance?

+3
source share
1 answer

We follow the same pattern that we use for all applications:

Create a registrar inside each class by setting the class type as the log name and register everything you need to enter the class in the local logger. Like this (for example ... there are other ways to declare a registrar):

private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

, , , .

+4

Source: https://habr.com/ru/post/1744916/


All Articles