Practical development tips for Windows Phone (22): use logs to record current information and exception information

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.