Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I monitor trace output of a .Net app?

I'm working on some code that uses the System.Diagnostics.Trace class and I'm wondering how to monitor what is written via calls to Trace.WriteLine() both when running in debug mode in Visual Studio and when running outside the debugger.

like image 911
Luke Avatar asked Sep 10 '08 17:09

Luke


People also ask

What is dotnet trace?

dotnet-trace collect. Collects a diagnostic trace from a running process or launches a child process and traces it (. NET 5+ only). To have the tool run a child process and trace it from its startup, append -- to the collect command.

What is trace in C#?

Tracing helps to see the information of issues at the runtime of the application. By default Tracing is disabled. Tracing has the following important features: We can see the execution path of the page and application using the debug statement. We can access and manipulate trace messages programmatically.

What is trace in Visual Studio?

Tracing is a feature in Visual Studio that allows the programmer to put a log message onto the main output window. The mechanism is fairly simple to use. It is only active with debug builds, in a release build none of the trace messages will be displayed.


3 Answers

Try Debug View. It works quite nicely.

like image 77
NotMyself Avatar answered Nov 10 '22 00:11

NotMyself


I use a simple little program called 'BareTail' which displays plain text files, updating it's display as the file gets written to and follows (or wraps) to the bottom of the file.

When running outside the debugger you'll need to attach a file-writer to write out the trace information, which you can do by adding a few lines to the .exe.config file

Hope that Helps ;o)

like image 39
Andrew Avatar answered Nov 10 '22 00:11

Andrew


Have a look at DevTracer. It also allows monitoring a .NET application remotely.

DISCLAIMER: I am the developer of DevTracer and therfore my opinion may not be neutral.

like image 43
nruessmann Avatar answered Nov 10 '22 01:11

nruessmann