ILog or ILogger?

2019-04-21 01:01发布

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
2楼-- · 2019-04-21 01:26

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.

查看更多
登录 后发表回答