What are the best practices for including logging using log4net?

后端 未结 9 1141
夕颜
夕颜 2021-02-07 04:04

I have been told to add “logging” to my code using log4net, the problem is no one can travel in time and see what real world problems the logging will need to be used to solve.<

9条回答
  •  广开言路
    2021-02-07 04:35

    I found this article very helpful: http://blog.codinghorror.com/the-problem-with-logging/

    In particular I think a minimalist approach is indeed the way to go. In the past I've tried to log too much but this bloats the code

    Also the thinking that the more log entries the better is wrong because it bloats the logs themselves. I now look at loggings main benefit as providing a "foothold" or overview of what is going on. If more detail is needed for particular areas then so be it but the default position should be less is better

提交回复
热议问题