How to package a log file with your exception reports

Download the article Download this article

Attaching a file to every error report is really easy with SmartAssembly Pro. In this 3-step walkthrough, you will see how to package a log file with your exception reports.

Step 1: Start from a sample error-reporting template

First, copy the sample error-reporting template named Standard from Program Files to a location where you can modify it (the Standard template is the same as the default error-reporting dialog template).

Templates

Figure 1. Locating the Standard error reporting template.

Step 2: Open your saved sample in Visual Studio and build it

Now, open your SmartAssembly project, go to Automated Error Reporting, and choose to use a custom template.

Choose your custom template

Figure 2. Selecting the "Custom Template" option within SmartAssembly.

Browse for the DLL file that you've just compiled. Then click Build for your error-reporting template to be used. Of course, you can't tell the difference yet, because it's still the same as the standard template.

Your template in Visual Studio

Figure 3. Updating your .dll in Visual Studio to use the new error reporting templace.


Error reporting dialog

Figure 4. The error dialog (with place-holder text), showing no changes to the users' experience.

Step 3: Incorporate your code change

Now you can go back to the source code of your custom template to modify it – add some code to add a log file to the report:

Code change

Figure 5. Updating your code to append a log file to error reports.

When you then receive an exception report related to this build, you'll get a log file packaged in each report.

Packaged log file

Figure 6. The log file, included in the error report.

Obviously, you can change the behavior or the dialog in whatever way you like. Some useful examples:

Try SmartAssembly for yourself: download your 14-day free trial.

Pricing
from $795
SmartAssembly is licensed per production build machine (any machine you use to produce release builds). A Support & Upgrade package is available for 25% of the product's purchase price.

Got a question?
0800 169 7433
Technologies supported

SmartAssembly can protect your Winforms, Silverlight, Windows Phone 7, ASP.NET applications and more. It can also be integrated into build processes using MS Build or the command-line.

See PDF for full details