kenwarner
kenwarner

Reputation: 29120

How to log an application's entire stacktrace in .NET

I've just started work on an existing .NET application with about 40 active projects. While familiarizing myself with the project, I find myself constantly stepping through the application just to learn the structure and logic flow. It would make this process so much easier if I could let the application run and log every method call and review the log afterwards. I know I can add Debug.WriteLine or Trace.WriteLine statements, but adding those statements to most methods in 40 projects sounds like overkill. Are there any good alternatives to this approach?

CLR Profiler introduced me to the appropriate keyword 'call graph' which led me to a duplicate question, How can I see a visualization of a dynamic call graph for a .NET program?.

Upvotes: 1

Views: 871

Answers (3)

heavyd
heavyd

Reputation: 17691

The CLR Profiler can give you the stack traces you are looking for.

Upvotes: 2

JP Alioto
JP Alioto

Reputation: 45117

You might check out RedGate ANTS. The purpose of ANTS is performance profiling, but the profiler does give you a very detailed view of what the profiled application is doing, lets you slice and dice the callstack and also lets you jump over to Visual Studio. It's a bit spendy, but well worth it.

Upvotes: 2

Cohen
Cohen

Reputation: 2720

Or you can use something like PostSharp to add the logging automatically for all the methods.

Upvotes: 1

Related Questions