Is wrapping log4net to reduce coupling an antipattern? Or injecting the logger instance into a public property an antipattern? How do you approach the log4net dependency?
Wrap a logger for below reasons -
- It isolates the change only to logger, in future if you want to change it to something better no cascaded changes.
- It makes your life easy when you want to write the test cases. You can easily mock the stuff required.
- If due to certain reasons you need to have more than one logger in your app, then wrapper helps. You can change the logger through some factory / registry. Ex - if a code is shared among different platforms/environments where you want to have different logger. You can make it factory/registry driven.
So, my view is good to wrap it.