Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2007

Tip: Looking for answers? Try searching our database.

logging debug messages

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
byaarov@yahoo.com - 08 Jun 2007 18:48 GMT
How do I display debug messages from a Win32 application project
(visual studio c++).  I'd like to print the messages in the output
window of visual studio
Peter Duniho - 08 Jun 2007 19:04 GMT
> How do I display debug messages from a Win32 application project
> (visual studio c++).  I'd like to print the messages in the output
> window of visual studio

Just add a new TraceListener to the Debug.Listeners collection.  You can  
then write the output of the Debug class wherever you like.
byaarov@yahoo.com - 08 Jun 2007 19:08 GMT
On Jun 8, 11:04 am, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
> > How do I display debug messages from a Win32 application project
> > (visual studio c++).  I'd like to print the messages in the output
> > window of visual studio
>
> Just add a new TraceListener to the Debug.Listeners collection.  You can
> then write the output of the Debug class wherever you like.

I just have a simple console application written in C... is there a
simpler way to do this?  I remember a while back there was a simple
function like DebugMessage or LogMessage or something like that, which
just wrote the input to the console window of the visual C debugger...
is there still something like that available?
David Lowndes - 08 Jun 2007 19:29 GMT
>I just have a simple console application written in C... is there a
>simpler way to do this?  I remember a while back there was a simple
>function like DebugMessage or LogMessage or something like that, which
>just wrote the input to the console window of the visual C debugger...
>is there still something like that available?

It sounds like you're looking for OutputDebugString()

Dave
byaarov@yahoo.com - 08 Jun 2007 19:33 GMT
> >I just have a simple console application written in C... is there a
> >simpler way to do this?  I remember a while back there was a simple
[quoted text clipped - 5 lines]
>
> Dave

Thank you!
Peter Duniho - 08 Jun 2007 19:49 GMT
> I just have a simple console application written in C... is there a
> simpler way to do this?  I remember a while back there was a simple
> function like DebugMessage or LogMessage or something like that, which
> just wrote the input to the console window of the visual C debugger...
> is there still something like that available?

I don't understand your question.  Your original post, to me, implied that  
you had debug messages already in the Output window, and you wanted to  
display them somewhere else (like print them, for example).

While OutputDebugString() works in some contexts, it's not the .NET way to  
do things.  There is a perfectly good, just-as-easy-to-use Debug class  
that is available in .NET.  If you are simply trying to find out how to  
get messages to the Output window in the first place, then Debug.Write()  
and Debug.WriteLine() are what you want.

I cannot imagine anything being simpler.  OutputDebugString() certainly is  
no simpler (though it's not much more complicated either).

If you then also want those messages logged elsewhere somehow, you can add  
a TraceListener to the Debug.Listeners collection.  Perhaps you don't need  
this, but if you do it's simple to add.  Assuming you are using the .NET  
Debug class in the first place, of course.

Pete
David Ching - 09 Jun 2007 02:42 GMT
> While OutputDebugString() works in some contexts, it's not the .NET way to
> do things.  There is a perfectly good, just-as-easy-to-use Debug class
> that is available in .NET.  If you are simply trying to find out how to
> get messages to the Output window in the first place, then Debug.Write()
> and Debug.WriteLine() are what you want.

But there is no .NET Debug class available to an MFC program!

-- David
Peter Duniho - 09 Jun 2007 05:18 GMT
> But there is no .NET Debug class available to an MFC program!

So?  The OP never said anything about MFC, and this is a .NET Framework  
programming newsgroup.

You are grossly mistaken if you are reading this newsgroup for information  
about MFC programming topics.

Pete
David Ching - 09 Jun 2007 05:21 GMT
> So?  The OP never said anything about MFC, and this is a .NET Framework
> programming newsgroup.
>
> You are grossly mistaken if you are reading this newsgroup for information
> about MFC programming topics.

Look at the newsgroups that the thread is posted to.

-- David
Peter Duniho - 09 Jun 2007 05:48 GMT
> Look at the newsgroups that the thread is posted to.

Yes?  You'll note that one of them is the  
microsoft.public.dotnet.framework newsgroup.  Just because someone can't  
be bothered to not cross-pollute newsgroups, I'm expected to only answer  
if my answer pertains to the *other* newsgroup(s) in the list?

I don't think so.
David Ching - 09 Jun 2007 06:13 GMT
> Yes?  You'll note that one of them is the
> microsoft.public.dotnet.framework newsgroup.  Just because someone can't
> be bothered to not cross-pollute newsgroups, I'm expected to only answer
> if my answer pertains to the *other* newsgroup(s) in the list?
>
> I don't think so.

Your other recent posts make you seem like a decent guy, so I'll cut you a
break.  I've removed the MFC newsgroup from this answer as you should have
done in yours.

-- David
David Wilkinson - 09 Jun 2007 11:22 GMT
>> Look at the newsgroups that the thread is posted to.
>
[quoted text clipped - 4 lines]
>
> I don't think so.

Just another example of why cross-posting is almost always a bad idea.

Signature

David Wilkinson
Visual C++ MVP

Tom Serface - 10 Jun 2007 16:03 GMT
I second that.  Cross posting == cross-confusion.

Tom

>>> Look at the newsgroups that the thread is posted to.
>>
[quoted text clipped - 6 lines]
>
> Just another example of why cross-posting is almost always a bad idea.
Hans-J. Ude - 09 Jun 2007 05:30 GMT
"Peter Duniho" <NpOeStPeAdM@nnowslpianmk.com> schrieb:

>> But there is no .NET Debug class available to an MFC program!
>
[quoted text clipped - 3 lines]
>You are grossly mistaken if you are reading this newsgroup for information  
>about MFC programming topics.

No he isn't. The OP did a crosspost without follow-up.

Hans
Owen Ransen - 09 Jun 2007 06:04 GMT
>> But there is no .NET Debug class available to an MFC program!
>
>So?  The OP never said anything about MFC, and this is a .NET Framework  
>programming newsgroup.

You have replied to an MFC group.

Easy to use graphics effects:
http://www.ransen.com/

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.