40

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

amicoderozer
  • 2,046
  • 6
  • 28
  • 44
  • Currently There is no way to achieve this. maybe you should try to request this feature via [Bugzilla@Mozilla](https://bugzilla.mozilla.org/) – Mehdi Dehghani Jan 30 '17 at 07:05
  • 1
    I imagined that, thank you @MehdiDehghani. If you want to post an answer i would be happy to accept it. – amicoderozer Jan 30 '17 at 08: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? – Sebastian Zartner Jul 24 '17 at 06: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. – amicoderozer Jul 31 '17 at 08:39
  • I too am interested in this. Here I am trying to solve some mystery, and I look over in my big monitor and see some tiny number growing arbitrarily; script working fine, just the reporting in console not as expected!! – Kalnode Apr 04 '18 at 23:34
  • Please, check [this](https://stackoverflow.com/a/61691468/2457251) answer. – Almir Campos May 09 '20 at 03:46
  • @AlmirCampos which answer? The link points me to the question – amicoderozer May 11 '20 at 09:30
  • 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. – Almir Campos May 12 '20 at 06:02

5 Answers5

14

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

Mehdi Dehghani
  • 10,970
  • 6
  • 59
  • 64
  • 2
    It does not work at least in Developer Edition 84.0b8 (64-bit). – Maxim Dec 04 '20 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) – Mehdi Dehghani Dec 05 '20 at 09:26
  • Not working both on 83.1 both on 84.0 on Linux. – 4javier Dec 17 '20 at 12:19
  • I'm afraid I have not Linux, I tested on Windows 10 – Mehdi Dehghani Dec 17 '20 at 14:04
  • 4
    This doesn't work as of Jan 2022. The option is present but it still groups console output when selected. – Mike Jan 23 '22 at 17:52
  • That only affects warnings and errors, it doesn't affect `console.log()` messages, they still get grouped (which is face-palmingly maddening because warnings and errors are the one you'd want to group and hide to reduce clutter and intentional messages are the ones you'd NOT want to group and WANT to see every one ). – Synetech Jul 18 '22 at 00:11
  • 1
    Bug tracking this: https://bugzilla.mozilla.org/show_bug.cgi?id=1615206 – FrequentGuest Dec 29 '22 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());

DaveS
  • 101
  • 1
  • 1
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

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
  • 9
    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 Feb 29 '20 at 11:25
  • 6
    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 Aug 21 '20 at 15:49
  • 3
    @ rossisdead Agreed, it doesn't seem to pay attention to this setting; groups for me regardless of the toggle state. – Ari Black Nov 12 '20 at 08: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.

Yeti
  • 2,647
  • 2
  • 33
  • 37
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