How to use log4net with Dependency Injection

前端 未结 4 1884
死守一世寂寞
死守一世寂寞 2020-12-04 09:16

I\'m trying to figure out what the right patter and usage of log4net is with a dependency injection framework.

Log4Net uses the ILog interface but requires me to ca

4条回答
  •  盖世英雄少女心
    2020-12-04 10:06

    How I did it was to create my own interface, and had a class implement that interface that used Log4Net, and injected that class. In that way you are not tied to Log4Net...you can just create another class for a new logger and inject that class.

提交回复
热议问题