在Excel Add-in中使用log4NET
来源:互联网 发布:淘宝禁售管理规范 编辑:程序博客网 时间:2024/06/05 22:37
在Excel Add-in中没有办法设定配置文件。所以我们需要在程序中设定Log4NET的配置。
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Xml.Linq;using Excel = Microsoft.Office.Interop.Excel;using Office = Microsoft.Office.Core;using Microsoft.Office.Tools.Excel;using log4net;using System.Diagnostics;using System.IO;namespace ExcelAddIn4{ public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { try { log4net.Config.BasicConfigurator.Configure(new log4net.Appender.FileAppender( new log4net.Layout.PatternLayout("%d [%t]%-5p %c [%x] - %m%n"), @"C:\******\testfile.log")); s.Close(); ILog log = LogManager.GetLogger(typeof(ExcelAddIn4.Globals)); log.Error("dddddddd"); } catch (Exception ex) { Debug.Print(ex.Message); } } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { } #region VSTO generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); } #endregion }}
- 在Excel Add-in中使用log4NET
- 在C#中使用LOG4NET
- 在C#中使用LOG4NET
- 在C#中使用LOG4NET
- log4net在项目中使用
- 在Office编程(add-in)中如何获得当前Word/Excel的名字
- 在asp.net中使用 log4net 笔记
- 在.net开发中使用Log4Net组件
- 在.net开发中使用Log4Net组件
- 在.net开发中使用Log4Net组件
- 在.net开发中使用Log4Net组件
- 在vs2005中配置使用log4net
- 在.net开发中使用Log4Net组件
- 在.net开发中使用Log4Net组件
- 在.net开发中使用Log4Net组件
- 在.net开发中使用Log4Net组件
- 在.net开发中使用Log4Net组件
- 在asp.net中使用 log4net 笔记
- 一次表空间配额错误的处理ORA-01536
- 2.14
- java正则表达式
- 文档测试
- poj3667
- 在Excel Add-in中使用log4NET
- fatal error LNK1104: cannot open file 'MSCOREE.lib'
- 一个怀疑染毒文件所做的简单比较
- ActiveMQ--示例
- 次小生成树
- hibernate 的三种状态
- RichEdit对ole 对象的相关支持总结
- 使用socket的Linux上的C语言helloworld多线程服务器和客户端测试程序
- 基于贝叶斯方法的英文单词模糊自动校对技术及其应用研究