471,337 Members | 1,068 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Debug trace

Hi,

I'm an MFC programmer and know little about .NET programming.
Now, for some reasons, I'm developing an ASP .NET application...
What I need to know is how to output into VS's Output Window like
what MFC's TRACE macro does (during debugging).

Could you please share your knowledge with me?

Thanks in advance.
--
======
Arman
Oct 29 '06 #1
3 2708
I have an example of doing it to a file on my website. You can just
replace TextWriterTraceListener with
System.Diagnostics.ConsoleTraceListener and it should all work the
same.

http://devdistrict.com/codedetails.aspx?A=20

Kelly S. Elias
Webmaster
DevDistrict - C# Code Library
http://devdistrict.com
Arman Sahakyan (donotspam) wrote:
Hi,

I'm an MFC programmer and know little about .NET programming.
Now, for some reasons, I'm developing an ASP .NET application...
What I need to know is how to output into VS's Output Window like
what MFC's TRACE macro does (during debugging).

Could you please share your knowledge with me?

Thanks in advance.
--
======
Arman
Oct 29 '06 #2
Hi Arman,

Add the following configuration to the web.config file in your application's
root directory:

<configuration>
<system.web>
<trace enabled="true" />
<compilation debug="true" />
</system.web>
</configuration>

<trace... /corresponds to Page.Trace methods.
<.. debug.. /corresponds to System.Diagnostics.Debug methods.

Debug will write to the Visual Studio output window as you requested, but only
if debug="true".

Trace output can be viewed in two ways:

1. Request "/trace.axd" in your browser when <traceis enabled. You'll see
the trace per request and a Details link to drill down to page-level trace.
The actual Page.Trace output is under the "Trace Information" section.

2. You can have page-level trace information appended to the end of each
requested page by making the following changes to the configuration above:

<configuration>
<system.web>
<trace enabled="true" pageOutput="true" />
</system.web>
</configuration>

3. You can have page-level trace information appended to the end of a
particular page by modifying the @ Page directive as follows:

<%@ Page ... Trace="true" ... %>

"Trace" can be added to the @ Page directive even when <traceis not enabled
in the web.config file.

Debug="true" can also be added to the @ Page directive even when using
debug="false" in the web.config file, but you'll have to attach the debugger
after building in VS 2005 to see what's written in the output window. IIRC,
that wasn't a problem in earlier versions of VS.NET.

--
Dave Sexton

"Arman Sahakyan" <ar********@rambler.ru(donotspam)wrote in message
news:2F**********************************@microsof t.com...
Hi,

I'm an MFC programmer and know little about .NET programming.
Now, for some reasons, I'm developing an ASP .NET application...
What I need to know is how to output into VS's Output Window like
what MFC's TRACE macro does (during debugging).

Could you please share your knowledge with me?

Thanks in advance.
--
======
Arman

Oct 29 '06 #3
Many thanks you guys. These are what I've been wondering.
--
======
Arman

"Dave Sexton" wrote:
Hi Arman,

Add the following configuration to the web.config file in your application's
root directory:

<configuration>
<system.web>
<trace enabled="true" />
<compilation debug="true" />
</system.web>
</configuration>

<trace... /corresponds to Page.Trace methods.
<.. debug.. /corresponds to System.Diagnostics.Debug methods.

Debug will write to the Visual Studio output window as you requested, but only
if debug="true".

Trace output can be viewed in two ways:

1. Request "/trace.axd" in your browser when <traceis enabled. You'll see
the trace per request and a Details link to drill down to page-level trace.
The actual Page.Trace output is under the "Trace Information" section.

2. You can have page-level trace information appended to the end of each
requested page by making the following changes to the configuration above:

<configuration>
<system.web>
<trace enabled="true" pageOutput="true" />
</system.web>
</configuration>

3. You can have page-level trace information appended to the end of a
particular page by modifying the @ Page directive as follows:

<%@ Page ... Trace="true" ... %>

"Trace" can be added to the @ Page directive even when <traceis not enabled
in the web.config file.

Debug="true" can also be added to the @ Page directive even when using
debug="false" in the web.config file, but you'll have to attach the debugger
after building in VS 2005 to see what's written in the output window. IIRC,
that wasn't a problem in earlier versions of VS.NET.

--
Dave Sexton

"Arman Sahakyan" <ar********@rambler.ru(donotspam)wrote in message
news:2F**********************************@microsof t.com...
Hi,

I'm an MFC programmer and know little about .NET programming.
Now, for some reasons, I'm developing an ASP .NET application...
What I need to know is how to output into VS's Output Window like
what MFC's TRACE macro does (during debugging).

Could you please share your knowledge with me?

Thanks in advance.
--
======
Arman


Oct 29 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Kevin | last post: by
10 posts views Thread by Scott | last post: by
4 posts views Thread by A.M | last post: by
7 posts views Thread by Thomas Pecha | last post: by
6 posts views Thread by swartzbill2000 | last post: by
3 posts views Thread by =?Utf-8?B?ZWxhZGxh?= | last post: by
2 posts views Thread by Bob S | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.