开发者

ILog or ILogger?

开发者 https://www.devze.com 2023-03-12 11:41 出处:网络
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:

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消