Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Test] Controlling Windows debug traceoutput
From: Alexander Lamaison (awl03_at_[hidden])
Date: 2009-08-08 07:17:15


"Gennadiy Rozental" <rogeeff_at_[hidden]> wrote in message
news:h54lmg$ik6$1_at_ger.gmane.org...
> Alexander Lamaison wrote:
>> My program uses ATL which provides an ATLTRACE macro
>> (http://msdn.microsoft.com/en-us/library/dhxsse89%28VS.80%29.aspx) which,
>> when given a string, will output this to the 'debug output'. The debug
>> output is not normally printed to the console unless running in the
>> debugger. In order to see it without the debugger you would normally
>> have
>> to use a tool such as DbgView to capture and display it.

> I have some suspicions why this might happen. Can you post simple example
> illustrating this behavior?

This code:

#define BOOST_TEST_MODULE Windows debug trace tests
#include <boost/test/unit_test.hpp>
#include <windows.h>
#include <atlbase.h>

BOOST_AUTO_TEST_SUITE(TraceSuite);

BOOST_AUTO_TEST_CASE(trace_test)
{
    int a = 3;
    OutputDebugStringA("Mary had a little lamb\n");
    OutputDebugStringW(L"Its fleece was white as snow\n");
    ATLTRACE("And everywhere that Mary went\n");
    ATLTRACE2("That lamb was sure to go\n");
    BOOST_CHECK_EQUAL( a, 3 );
}

BOOST_AUTO_TEST_SUITE_END();

Produces the following output:

    Running 1 test case...
    And everywhere that Mary went
    That lamb was sure to go

    *** No errors detected

Notice that only the ATL trace functions appear in the Boost.Test output. I
tried to follow the ATL trace code through but ended at the declaration of
AtlTraceVU(...) without any more source to look at so I can't see what it
does from there.

Any ideas?

Thanks.

Alex


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net