ILog or ILogger?

天大地大妈咪最大 提交于 2019-12-22 03:25:13

问题


Should I be using the ILog or ILogger interface? I find the ILog interface to be easier to use since I can just declare one instance per class by calling:

private ILog _logger = LogManager.GetLogger(typeof(MyClass));

It's a much simpler interface then the ILogger:

void Log(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception)

Is there a difference? When is it better to use 1 vs the other?


回答1:


I recommend the ILog interface. This has been pushed by Apache/Common Logging. If you use the common logging interface, then most logging systems can be plugged into your application.

I find log4net to be more than adequate.



来源:https://stackoverflow.com/questions/6338107/ilog-or-ilogger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!