Minimizing journal reports in production

I have a C # console application project that uses log4net as a logging library. Throughout the application, there are logging operators ( log.Debug(), log.Error()etc.) that are printed to the console as the program starts.

What is the best way to modify logging instructions in a production environment to minimize execution time caused by logging? I would like some of the applications not to be printed at all, and some registration applications to be printed only during production.

I am thinking of adding new parameters to a file Web.configthat determines how the log changes. However, I think I also need to override the methods log.Debug()and log.Error()to work with a new parameter, but I'm not sure how to do it. Can anyone advise?

+4
source share
2 answers

You should probably distract your logging library from your application, so you would control your logging behavior, and your project was loosely related to your log4net dependency.

, , , , . ,

0

Web.config , log4net , - .

Web.config , , . :

0

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


All Articles