10

I use Firefox + Firebug for some Javascripting. The text I'm trying to log with console.log does not immediately appear in Firebug's console. It seems like it piles up in a buffer somewhere, and then gets flushed to console in chunks. I have a function that makes a few log calls. Sometimes I get just the first line, sometimes - nothing. I do, however, see the whole bunch of lines when I refresh the page.

Can I flush the console log manually?

Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
  • 1
    Uh, sounds more like an issue with your code to me, I don't think the console has issues like that, but then again Firebug logs all sorts of crap, so who knows. – adeneo Mar 10 '14 at 16:51
  • Could you provide the code you use? To me it also sounds like it's a problem in your code. @adeneo Firebug just logs the messages coming from Firefox (besides the messages triggered manually via the `console` object methods). And you have different filter options to control their display. So you're in control of what "crap" you want to see. :-) – Sebastian Zartner Mar 10 '14 at 20:37

2 Answers2

6

The short answer is no. There is no flush. You could clear the console

console.clear();

But I don't think that's what you want. This is most likely from the code. If we can see it, I can revise my answer with better feedback.

If you want to see all the available methods under console, execute this in the command line:

for(var i in console) {
    console.log(i);
}

or have a look at the wiki page of the console API.

Sebastian Zartner
  • 18,808
  • 10
  • 90
  • 132
MGot90
  • 2,422
  • 4
  • 15
  • 31
1

It's not a Firefox problem, It's a JavaScript problem because execution is delayed and variables are updated so you can see only the last value.

To see immediately the output you need to convert your object in string so it will not change also if object will be updated.

I wrote this easy function :

function printLog(s) {
   if (typeof(s) === 'object') {
      console.log( JSON.stringify(s) );
   } else {
      console.log(s);
   }
}

The printed output is a string (so you can't interact with it) but it contains the real dynamic object that you want to see at the print time instant.

Debug Diva
  • 26,058
  • 13
  • 70
  • 123