Windows Phone 实用开发技巧(22):使用日志记录当前信息与异常信息

来源:Alexis的51博客 责任编辑:栏目编辑 发表时间:2013-07-02 05:43 点击:

What is logging ?

 Logging is the felling, skidding, on-site processing, and loading of trees or logs onto trucks. And since windows phone is much more event driven. you can find more information in Event Logging.

Why to use logging ? 

Exception is everywhere in common software development. A good logging tool may helps a lot in solving problems. Here I recommend logging tool in WP7Contrib. 

Here I created a helper class to do better and easier logging.

 

 

We can log common information as well as Exception simply by pass different parameter. We can also log device information since it may be help in finding which device goes wrong. 

How to use it ?

First, we should add dll reference to our main project, shown as follow:

 

After that, we manually generate a DivideBvZeroException, shown as below: 

 

Here, I use LoggingHelper(shown before) class  to log exception.As we run the app, we can find exception both in output and log.dat which is the file store logging.

 

 

Ok, it is very simple to use. you can find source code here.

本文出自 “Alexis的51博客” 博客,请务必保留此出处http://alexis.blog.51cto.com/2621421/672033

    相关新闻>>

      发表评论
      请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
      用户名: 验证码:点击我更换图片
      最新评论 更多>>

      推荐热点

      • Windows Phone 项目实战之我的微盘(下)
      • Windows Phone 实用开发技巧(26):对DataTemplate中的元素播放
      • Windows Phone 实用开发技巧(25):Windows Phone读取本地数据
      • Windows Phone 实用开发技巧(27):创建透明Tile
      • Windows Phone 知识锦(12月版)
      • Windows Phone实用开发技巧(31):密码加密
      • Windows Phone 项目实战之我的微盘(上)
      • WP7实例篇之土豆搜索器(2)
      • [翻译]WP7 QuickStart-第七篇-布局
      网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
      Copyright © 2008-2015 计算机技术学习交流网. 版权所有

      豫ICP备11007008号-1