Patrick Szalapski
Patrick Szalapski

Reputation: 9439

How can I see console output from inside WCF service while debugging?

How might I see the SQL query generated from LINQ to SQL when debugging inside a WCF service? I thought I might just set dataContext.Log = Console.Out and the SQL would be written to the output/immediate window. It doesn't--is that because I am hosting using IIS? Console.WriteLine("Hello") doesn't even write anything to the output/immediate window.

How do see my console output?

Upvotes: 5

Views: 9362

Answers (2)

YetAnotherUser
YetAnotherUser

Reputation: 9356

You may want to write it to a file instead. dataContext.Log takes any TextWriter.

See this comment for a nice way to get a text writer writing to Debug.

Upvotes: 2

Marco
Marco

Reputation: 57583

You can try to use System.Diagnostics.Debug.WriteLine(), so when you distribute Release app these lines will be stripped out from code.

Upvotes: 6

Related Questions