英国阿伯丁大学计算机专业代写:如何使用Log4net记录C#

为了灵活性,log4net使用记录器,appender和布局。记录器是控制记录的对象,是ILog接口的实现,它指定了五个布尔方法:isDebugEnabled,IsInfoEnabled,IsWarnEnabled,IsErrorEnabled和IsFatalEnabled。它还指定了五个方法 - 调试,信息,警告,错误和致命 - 以及重载和五个格式化的字符串版本。您可以在log4net联机手册中看到完整的ILog界面。记录仪被分配一个等级,但不是全部或关闭,只有其他五个。 Appender控制日志记录的位置。它可以在数据库,内存缓冲区,控制台,远程主机,带有滚动日志的文本文件,Windows事件日志,甚至通过SMTP发送到电子邮件。共有22个appender,并且它们可以组合在一起,所以你有很多选择。 Appender被附加(因此名称)到记录器。 Appender通过匹配子字符串,事件级别,级别范围和记录器名称开始来过滤事件。 英国阿伯丁大学计算机专业代写:如何使用Log4net记录C# For flexibility, log4net uses loggers, appenders, and layouts. A logger is an object that controls logging and is an implementation of the ILog interface, which specifies five boolean methods: isDebugEnabled, IsInfoEnabled, IsWarnEnabled, IsErrorEnabled and IsFatalEnabled. It also specifies the five methods—Debug, Info, Warn, Error andFatal—along with overloads and five formatted string versions. You can see the full ILog interface in the log4net online manual. Loggers are assigned one of the levels but not ALL or OFF, only the other five. Appenders control where the logging goes. It can be into a database, to an in-memory buffer, to the console, to a remote host, to a text file with rolling logs, the Windows Event Log, or even to email via SMTP. There are 22 appenders in all, and they can be combined so you have plenty of choices. Appenders are appended (hence the name) to a logger. Appenders filter events by matching substrings, event...
Read More