Tuesday, December 15, 2009

How to use DebugView tool ?


When I was developing BizTalk Applications, I used to work with EvenLog command to trace BizTalk work flow actions in Development Phase.

Then in deployment phaseI go through all EventLog commands to remove them.

DebugView is a cool tool is provided from microsoft and it needs some simple steps to use it, I will show you a simple example how to use it:

1- Download the tool from http://www.microsoft.com/technet/sysinternals/Miscellaneous/DebugView.mspx

2- Extract the zip file and run Dbgview.exe

3- I created a simple windows application with button and I added the following to button event.

System.Diagnostics.Debug.WriteLine("test -" + " Debug Suleiman");
System.Diagnostics.Trace.WriteLine("test -" + " Trace Suleiman");

4- I ran the application in debug mode then I clicked the button and I found following in DebugView.exe window

5- If you want to filter the view and highlight your required event, you have to click edit then Filter/Highlight or ctrl+L shortcut.

6- In this example I included all (*) , exclude empty and Trace in green highlight in Filter1 & Debug in purple highlight as the following:


7- If I convert my application to release mode you and click button again, will find that just Trace will be viewed

Conclusion:

Event logging uses disk space and normally takes processor time away from applications. So do not store unimportant information or large quantities of data in the event log. Generally, an event log should be used to log unexpected conditions or errors and not user actions or performance tracking information.

use System.Diagnostics.Debug.WriteLine("") will be viewed in Debug mode
Debug command does not work with Release Mode
System.Diagnostics.Trace.WriteLine will be viewed in both Release & Debug modes

You can use DebugView to check your required actions and you don't need to remove your trace lines in deployment phase. and your actions will be viewed by this cool tool

There are filter option and you can import/export your trace logs

No comments: