I use log4net at work all the time. When I first started using it years ago, I got a reference to the logger by passing in my class name. But if you have to refactor code, you may forget to change the name that you used for your logger. This can cause trouble later while debugging. Below is a simple way to get a logger.
private static readonly ILog log = LogManager.GetLogger(
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
No comments:
Post a Comment