Design for debugging

Source: Internet
Author: User
After we release a product to market, it's not uncommon that our customer report bugs to us, even we gained a of Lot confidence from "thorough" tests by ourselves and QA guys. if it occurs, we usually don't have the luxury to perform debugging in production environment with a debugger. so, it's important we design in advance to help us debugging in this situation.
I read from Darin Dillon 'S Debugging strategies for. NET developers That they always have several testing boxes to run released products. and it's strictly prohibited to install any development tools on them. it seems to be an extreme stern rule and hurt debugging efficiency. but I think it's a beneficial rule for producing a great product. this way, we developers are forced to think about how to make debugging easier in this situation which may occur frequently on MERs 'sites.
Take Microsoft's Windows for example, there are plenty of ways to assist debugging in released version. such as dr. watson for collecting dump file, error reporting mechanisms, System Event Log, etc. engineers at MS are doing their best to collect as much information as possible when unexpected behavior occurs. you can hardly imagine is one of your application crashes and the tech support guy from MS asked you to assist him attaching a remote debugger to your machine. neither will we be able.

means :
1. logging
It's no doubt logging will be the first one jumping into our head. logging is a good way on customer's site since it doesn't require the customer to install any additional software to enable it. while using this feature, we must always be cautious not to simply use printf or debug. writeline otherwise we'll easily be overwhelmed by a mess of log flood.
A not-bad logging system shocould at least be able to or have: toggle ON/OFF, consistent style and proper layout. it's better to have the ability to set logging level to avoid log flood when possible. preferably, we can choose a mature logging Library such as log4net.
an important requirement is that the logging system cocould be configured without recompilation. the best way is it can even be toggled at runtime without restarting the application. dbgview is a great tool can achieve so. (Ken. zhang explained its work mechanic in this article .)

2. dump file
log file has the advantage of keeping record of what's happening as time goes, but you can only see part of information that you explicitly output. dump file is a copy of a process on customer's site that you can examine on your developing machine to view other information missing in log. but it's a static image of the process at a fixed time. usually, it also doesn't require install a specific software to generate dump file. core dump on Linux and dr. watson on windows are supported by a naked OS installation.
if we need to perform some mizmizations on these tools, we 'd better provide a friendly GUI tool to the customer so that a average user can use.

3. source control tag
after we released a product, it's important we keep a record of the Source Control System Version tag correlates to the release. it's mandatory that we examine the correct code to hunt for a bug. it's not possible that we commit new code to repository after the product has been released and the most recent code doesn't match the product release. how disappointed will we be if we seem to get some clue for a bug but are not able to retrieve the correct code. so, it's important for us to find out the source control system version tag for any release.
BTW, on Windows, it's also important to keep a copy of related symbol file for each release. refer to: PDB files: What every developer must know by John Robbins

4. Information Collector
the product shoshould have at least passed testing in the Development Department. so we usually need to focus on the difference between the customer's environment and our own. those difference are very likely to be the culprit. msinfo32.exe is a good candidate for this goal.

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.