Coder Social home page Coder Social logo

log4wince's Introduction

log4WINCE

log4WINCE

跨平台的日志工具,修改了几行,移植到WINCE平台上。修改内容如下:

让log4,能读取根目录下的StartForm.exe.config,StartForm为程序的入口exe文件名。 修改文件地址:logEncapsulation/ LogHandler.cs public void Write(LogType type, string module, string eventname, string message, Exception ex)方法中 操作:在代码log4net.ILog logger = null;后添加如下代码 string xmlPath=this.NativeEntryAssemblyLocation; if (!string.IsNullOrEmpty(xmlPath)) { FileInfo fI = new FileInfo(xmlPath+".config"); XmlConfigurator.Configure(fI); }

写日志,log4默认在程序根目录下建立log.txt文件,或者根据conifg配置在根目录下建立相应的文件路径。要想实现在其他目录下新建日志,我修改了log4的源代码。 修改文件地址:Log4WINCE/ Util/ SystemInfo.cs/ 932行的public static string ConvertToFullPath(string path)方法中string applicationBaseDirectory = SystemInfo.ApplicationBaseDirectory; 修改为 string applicationBaseDirectory =@"\NandFlash"; 这样log4写的日志是以NandFlash为根目录写的。 如果WINCE的文件夹地址不一致,直接修改源码重新编译即可。

经测试可用。 配置文件见TestLog4WINC中的TestLog4WINCE.exe.config。 使用时引用到项目,配置文件复制到TestLog4WINCE.exe.config即可。

log4wince's People

Contributors

qxp1011 avatar

Stargazers

 avatar Lenic avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

gastonfeng

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.