Logging

Injected log4net Logger

Blog post is for personal reference for the cases when you need to get instance of some sort of logger from the Logging library you are using. It depends on logging library that you use but usually you may get instance of logger itself by providing some metadata about calling site or producer of the log entries. Code usually looks somewhat similar: private readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); As you can see it’s not really ready for injection as it requires concrete type in order to…

Keep reading