42

Anyone knows how to avoid firefox console to group log entries?

I have seen how to do it with firebug https://superuser.com/questions/645691/does-firebug-not-always-duplicate-repeated-identical-console-logs/646009#646009 but I haven't found any group log entry in about:config section.

I don't want use Firebug, because it's no longer supported or maintained and I really like firefox console.

I try to explain better, I want console to print all logs and not the red badge with number of occurences of one log string:

enter image description here

In the above picture I would like to have two rows of the first log row, two rows of the second and three of the third.

Is this possible?

Thanks in advance

8
  • Currently There is no way to achieve this. maybe you should try to request this feature via Bugzilla@Mozilla Commented Jan 30, 2017 at 7:05
  • 1
    I imagined that, thank you @MehdiDehghani. If you want to post an answer i would be happy to accept it. Commented Jan 30, 2017 at 8:04
  • The counter badge helps that the console doesn't get flooded with exactly equal output. So, what's the reason you want to see those logs separately? Commented Jul 24, 2017 at 6:17
  • @SebastianZartner I had this particular debug case in which i needed to know the exact sequence of the log strings. I solved it anyway but i was just curious to know if it was possible to separate the duplicates. Commented Jul 31, 2017 at 8:39
  • 1
    @amicoderozer Sorry for the confusion. I wrote a big answer and noticed that I mixed some things in it (late night + zillions of windows open), so I removed it to make the corrections later. The short answer is that this "Group Similar" thing doesn't work correctly neither in Chrome nor in Firefox. FORTUNATELY, if you simple check the "Show Timestamps" on Firefox (I'm using the version 76) you will have the messages separate. Unfortunately, Chrome doesn't do that. It keeps showing the number of occurrences using the first timestamp. In my original answer I make a point that this is an Error. Commented May 12, 2020 at 6:02

5 Answers 5

15

Update [2022-01-24]

Seems like the below option doesn't work as expected. feel free to report it as a bug

Update [2020-01-28]

Firefox team added option to group similar messages, which is enabled by default.

You can access to this option via Console settings

  • Open up Firefox's dev tools
  • Select Console tab
  • Click on gear button (placed at the right of the toolbar)
  • Change the option as you wish

Original Answer

As I mentioned in comment section, There is no way to achieve this at the moment. maybe you should try to request this feature via Bugzilla@Mozilla

Also you can check Gaps between Firebug and the Firefox DevTools

7
  • 2
    It does not work at least in Developer Edition 84.0b8 (64-bit).
    – Maxim
    Commented Dec 4, 2020 at 17:59
  • It works as expected in v83, so make sure you using latest stable version. also you can report the issue. (try with brand new profile, or refresh Firefox via about:support before reporting the issue) Commented Dec 5, 2020 at 9:26
  • Not working both on 83.1 both on 84.0 on Linux.
    – 4javier
    Commented Dec 17, 2020 at 12:19
  • 4
    This doesn't work as of Jan 2022. The option is present but it still groups console output when selected.
    – Mike
    Commented Jan 23, 2022 at 17:52
  • 2
    Bug tracking this: bugzilla.mozilla.org/show_bug.cgi?id=1615206 Commented Dec 29, 2022 at 23:08
9

As a workaround you can append a Math.random() to the log string. That should make all your output messages unique, which would cause them all to be printed. For example:

console.log(yourvariable+" "+Math.random());

0
4

There is a settings menu () at the right of the Web Console's toolbar now which contains ✓ Group Similar Messages:

Firefox's Web Console

3
  • 10
    I see settings, I see changing preference "devtools.webconsole.groupWarningMessages", but it does nothing and still group messages even in fresh FF. Any idea? Or is it bug?
    – Bonewolf
    Commented Feb 29, 2020 at 11:25
  • 7
    Is it just me, or do neither of the "Group Similar Messages" and "Show timestamp" settings work at actually stopping the grouped messages? I'm trying to see some console.log output, but it's still grouping everything together. Firefox v79
    – rossisdead
    Commented Aug 21, 2020 at 15:49
  • 4
    @ rossisdead Agreed, it doesn't seem to pay attention to this setting; groups for me regardless of the toggle state.
    – Ari Black
    Commented Nov 12, 2020 at 8:55
2

To solve this for any browser, you could use this workaround: Override the console.log command in window to make every subsequent line distinct from the previous line.

This includes toggling between prepending an invisible zero-width whitespace, prepending a timestamp, prepending a linenumber. See below for a few examples:

(function()
{
    var prefixconsole = function(key, fnc)
    {
        var c = window.console[key], i = 0;
        window.console[key] = function(str){c.call(window.console, fnc(i++) + str);};
    };

    // zero padding for linenumber
    var pad = function(s, n, c){s=s+'';while(s.length<n){s=c+s;}return s;};

    // just choose any of these, or make your own:
    var whitespace = function(i){return i%2 ? '\u200B' : ''};
    var linenumber = function(i){return pad(i, 6, '0') + ' ';};
    var timestamp = function(){return new Date().toISOString() + ' ';};

    // apply custom console (maybe also add warn, error, info)
    prefixconsole('log', whitespace); // or linenumber, timestamp, etc
})();

Be careful when you copy a log message with a zero-width whitespace.

1
  • This actually worked for me, thanks a lot! Commented Jan 8, 2021 at 16:08
1

Although you still cannot do this (as of August of 2018), I have a work-around that may or may not be to your liking.

You have to display something different/unique to a line in the console to avoid the little number and get an individual line.

I am debugging some JavaScript.

I was getting "Return false" with the little blue 3 in the console indicating three false results in a row. (I was not displaying the "true" results.)

I wanted to see all of the three "false" messages in case I was going to do a lot more testing.

I found that, if I inserted another console.log statement that displays something different each time (in my case, I just displayed the input data since it was relatively short), then I would get separate lines for each "Return false" instead of one with the little 3.

So, in the code below, if you uncomment this: "console.log(data);", you will get the data, followed by " Return false" instead of just "false" once with the little 3.

Another option, if you don't want the extra line in the console, is to include both statements in one: "console.log("Return false -- " + data);"

function(data){

   ...more code here...

    // console.log(data);
    console.log("Return false ");
    return false;
}

threeWords("Hello World hello"); //== True
threeWords("He is 123 man"); //== False
threeWords("1 2 3 4"); //== False
threeWords("bla bla bla bla"); //== True
threeWords("Hi"); // == False

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.