DBG not printing to console in Visual Studio Community 2015


#1

I create a fresh GUI project from the ProJucer.

 In my main content component's constructor I do:

DBG("foo");

 I run the project, but the output window doesn't display "foo" even though setting a breakpoint gets hit.

This was working last week!

What's going on?

π

PS Can my JUCE app display this output?

PPS std::cout also fails similarly.


#2

Gottit!

It's going to the Immediate window not the Output window!

gah! VS!

π


#3

Having the same issue here.

I have been developing on xcode so far but now I need to debug windows specific problem, and I can’t find those prints anywhere - not even the immediate window. Any suggestions?

Edit: Using visual studio 2015 professional here, should be the same…?


#4

Just tried here, it goes to Output for me, using VS2015 community
But only if you run a Debug build, in Release it is silent.


#5

I am running debug build but it does not show any of my DBG macros there. It prints out a lot of stuff from inside the JUCE framework, however.


#6

Do you maybe set a Logger? If so, it can override the behaviour of Logger::outputDebugString(const String& text), which is called by the DBG macro.
One other thing would be to set a breakpoint next to the DBG, whose output you are missing, maybe it is not called…? You never know… :wink:


#7

I don’t, not by myself at least, but the code base is not all of my doing so I’ll have to check. Thanks for the tip!. I am certain that those lines of code do run, as I get none of those DBG macros to print out currently. And certainly some of them are located in such places that the application would not work at all if those lines were not encountered.

How should I override that logger behavior? Now it produces the same results, which is nothing on the output console.

Example: these are the first lines that are run at the startup so can’t be missed:

    Logger::outputDebugString("test");
    
    DBG( "JUCE VERSION: ");
    DBG( JUCE_VERSION );
    cout << " <> " << time(nullptr) << " <<<----------------" << endl;

…and from those nothing shows up. Cout not showing up is understandable as we are speaking about visual studio, but what is it that can be wrongly configured with the logger/DBG -macro that would impede it printing out to this console window in visual studio:


#8

by subclassing the Logger class and setting it via the static function Logger::setCurrentLogger(new MySilentLogger());
But was just a shot in the dark…

Maybe somebody else has something to look for… good luck!

EDIT: but maybe look for any “setCurrentLogger” calls in the project, you can silence it also by supplying a nullptr I just read…


#9

Well, could not find out why the DBG macro ain’t working, so I decided to try FileLogger, but to no avail. Just can’t understand why this is wrong:

const File logfile(“c:\jucelog.log”);
FileLogger* filelogger = new FileLogger(logfile, “welcome”, 2000);
Logger::setCurrentLogger(filelogger);

That line Logger::setCurrentLogger(filelogger) requires a pointer to a subclass of Logger as its only parameter, but that line gives me an error: no type named setCurrentLogger in juce::Logger. Any suggestions why this might be happening, or what I should do differently?


#10

Need a double backslash?


#11

Actually that one has already been fixed, I guess I should edit it out for the example in here also - so no, that’s not the reason there, I’d guess…?

const File logfile("c:\\jucelog.log"); FileLogger* filelogger = new FileLogger(logfile, "welcome", 2000); Logger::setCurrentLogger(filelogger);

Visual Studio and XCode both give an error from the third line of that snippet. XCode says “No type named ‘setCurrentLogger’ in ‘juce::Logger’”, and Visual Studio says:

Edit: confirmed, they think I’m trying to redeclare that Logger::setCurrentLogger() -method


In other news, I got the DBG macro to work finally! I had basically release settings under my debug in the project file, which means that those DBG macros did not get compiled - feeling a bit dumb right now :flushed: