Redirecting driver errors to a file ?

Started by
5 comments, last by Fruny 17 years, 11 months ago
Hi, When you run DirectX with the debug runtime, and set the Deubg Output Level to the max, you can usually see a lot of warings / errors being sent to the Visual Debug Output. I'd like to redirect those messages to a log file, but I can't find any information on that. Do anyone know if it's possible ? And if so, how to do it ? Thx in advance.
Advertisement
This is probably more of a General Programming question. Have a look at This article, and see if that helps. It's in MDX, but it should translate to C++ without much difficulty.
Thx for the answer. I didn't read it in detail, but let me explain a little better my problem :

I'd like to redirect messages generated by the DirectX runtime. Not by my code. Those messages are stuff like :

"D3DX: Matrix should be 16-byte aligned for better performance"

And I don't have any control on that. It's not inside my code, there is no function to desactivate that, other than the DirectX configuration panel.
Quote:Original post by paic
Thx for the answer. I didn't read it in detail

Yea, go back and read it - it is exactly what you want. From within a process, you can capture all messages sent to OutputDebugStream() on its behalf. This will let you capture these messages and do whatever you want with it.

I should do this sometime too, it would be nice to have.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Odds are the error messages are being sent to the standard error stream. Redirect that.

In C: stderr = freopen(stderr, stuff goes here)
In C++: std::cerr.rdbuf( stuff goes here )

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
I thought that stderr ended up on stdout? Or it did the last time I tried it with VC6. Although it's entirely possible I was doing something wrong...
Quote:Original post by Evil Steve
I thought that stderr ended up on stdout? Or it did the last time I tried it with VC6. Although it's entirely possible I was doing something wrong...


They both end up on the console by default, but they are two separate streams that can be independently redirected.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement