Windows Phone 实用开发技巧(22):使用日志记录当前信息与异常信息
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.
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
相关新闻>>
- 发表评论
-
- 最新评论 更多>>
您可能感兴趣的文章
- Pocket PC获取路径的六种方法
- Windows Phone实用开发技巧(1):保存图片及加载图片
- 白话算法(7) 生成全排列的几种思路(三) 临位对换法
- Windows Phone 7 开发之Microsoft.Phone.Tasks中
- Windows Phone 7 开发探索笔记5——页面间导航
- Windows Phone 实用开发技巧(11):让StackPanel中的
- Windows Phone 实用开发技巧(23):强制关闭SIP
- 小试Sketchflow for Windows Phone 7
- Windows Phone 7 最新的开发工具库
- Windows Phone 实用开发技巧(2):使用TombstoneHelp