Windows Phone 實用開發技巧(22):使用日誌記錄當前信息與異常信息

What is logging ?windows

 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.app

Why to use logging ? ide

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

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

 

 

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. code

How to use it ?

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

 

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

 

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.ip

 

 

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

相關文章
相關標籤/搜索