Common Infrastructure Libraries for .NET(1)-------Common.Logging Framework

由于Quartz.net用到了Common.Logging组件作为日志的实现方式,有必要学习下。
官方网址:http://netcommon.sourceforge.net/index.html
官方文档: http://netcommon.sourceforge.net/docs/2.1.0/reference/html/index.html

 
目前比较著名的一些日志模块有:log4net, Enterprise Library Logging, NLog
Common.Logging在抽象层面上担任了适配器的角色,官网有句话:
Common.Logging library introduces a simple abstraction to allow you to select a specific logging implementation at runtime. Thus you can defer the decision what particular logging library to use until deployment. Adapters are used for plugging a particular logging system into Common.Logging.
由于Common Logging是一个日志的基础设施接口,因此更换到其他日志框架,也不需要修改程序代码.

使用方法
1.引用通用接口的Common.Logging.dll
2.然后根据需要引用具体实现的日志模块(log4net, Enterprise Library Logging, NLog),Common.Logging.XXX.dll,起到适配器的作用
3.最后引用XXX.dll

posted @ 2012-08-28 12:55  nickycookie  阅读(735)  评论(1编辑  收藏  举报