I need to debug an issue in our Release build on Windows, but can’t seem to get any output to show up anywhere. I tried using MessageBox, but that required that I add <Windows.h>, which then generated conflicts with basic types such as Rectangle when building.
On Mac, I can fprintf to stderr, but neither stderr nor stdout seem to show up when running a DAW from the command line like I can do on the Mac.
How can I generate and see some kind of debugging statements in a Release build?
Hmm. A FileLogger requires managing its lifetime someplace, which I’m not sure how to implement easily in a form similar to DBG. And it has to only be turned on when I set a flag someplace in the code, so I don’t generate this info for users, only for my own testing.
Is there a way to see stdout or stderr output on the PC when not in a debugger? If so, I could use fprintf.
You could use Juce’s Logger::writeToLog and DebugView to view the messages. (writeToLog uses OutputDebugStr on Windows to output the messages, printf on other systems.)
If you omit this line, it will fall back to log via DBG, i.e. do nothing in release builds. So it is very simple to add e.g a command line argument to turn it on or off…
And to log, there is a static call as well, so really simple to use:
Logger::writeToLog ("Whatever to log: " + String (foo));
(not sure, if the convenient << operator works here as well, like in DBG, try it out…)