所属类别:.NET
文章作者:未知
特别推荐:免费发布信息 承包关键词~~抢爆了!HOT!
log4j是java开发人员所熟悉,他提供了强大的日志记录功能,log4net是为.Net记录日志开发的.使用示例如下(C#):1、app.config文件<?xml version="1.0" encoding="utf-8" ?>2、log4net.config文件<?xml version="1.0" encoding="utf-8" ?><!-- This section contains the log4net configuration settings --><!-- Define some output appenders --><!-- Setup the root category, add the appenders and set the default level -->3、代码文件using log4net;using log4net.Config;class Program{private static ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);/// /// 应用程序的主入口点。/// [STAThread]static void Main(string[] args){try{DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"]));logger.Info("Start application...");Console.Writeline(“请按 键退出...");System.Console.ReadLine();}catch (Exception e){logger.Info (e);}}}关闭本页
相关信息· ASP.NET:处理session
· 用数字证书保护你的文档
· Ext4即将完成开发 为Btrfs架起桥梁
· Firefox在Linux系统配置文件夹的默认路径
74890
48521
