I use log4net for my logging needs throughout my solution (which has various projects which in return have various classes).
Is it really needed to always create an instance (aka object) like so:
private static readonly ILog log = LogManager.GetLogger(typeof(MyApp));
or the way I do it:
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
To use log4net? Isn’t there an alternative to this so that I don’t have to do it ever class and thus requires less copy and pasting 🙂 ?
With the help of a tiny helper:
you don’t duplicate the code, you just refer to the logger as: