473,386 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 2839
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kevin | last post by:
Hi All, Can someone please tell me what the difference is between DEBUG and TRACE. From what I can see, they are two different classes, but with the same members? Whats the purpose of have two...
0
by: Pete W | last post by:
I have a console application for which I have atttemped to use TextWriterTraceListener. The app uses System.Diagnostic I want to trace or debug to Console and also to file. code in Main()...
10
by: Scott | last post by:
I have a simple asp.net app which works fine in debug mode, but crashes on the following line when I run it on the production server: Dim dt As DataTable I have tried the following variations...
4
by: A.M | last post by:
Hi, If I use System.Diagnostics.Debug.WriteLine in a asp.net application, where does the output go? Is there any trace monitor application thar shows me the trace output? Thanks, Allan
7
by: Thomas Pecha | last post by:
Sorry for all who think this is easy, I was not able to handle this Coming from VB6 where with simple debug.print strAString you could write to debug window, I am totalling failing in vb.net...
6
by: swartzbill2000 | last post by:
Hello, I have a VB 2005 Express project with a TraceListener-derived class to route Debug.Print output to a log file. It works fine for Debug builds. What is the correct combination of changes to...
3
by: =?Utf-8?B?ZWxhZGxh?= | last post by:
Hi. I was wondering if it was possible to give a variable different values depending on if the code was compiled in debug or release? i.e. if the code was compiled in debug: string...
2
by: Bob S | last post by:
I am using Debug.WriteLine and Trace.WriteLine to output messages from a dll. This dll is used in an application. No matter whether i run the program in release mode or debug mode and whether i...
2
by: joelkeepup | last post by:
Hi, I made a change this morning and now im getting an error that says either "a is undefined or null" or "e is undefined or null" the microsoft ajax line is below, I have no idea how to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.