Brock Adams
Brock Adams

Reputation: 93553

How to stop Firebug from truncating strings in the console?

While debugging, I frequently dump strings and arrays to the console. But in some cases, Firebug chops up string values, making it hard to be sure of the result.

For example, this code in the console:

console.log ( [
    "123456789A123456789B123456789C123456789D123456789E123456789F123456789G",
    "123456789A123456789B123456789C123456789D123456789E123456789F123456789G"
] );

Yields:

[ "123456789A123456789B123...89E123456789F123456789G",
  "123456789A123456789B123...89E123456789F123456789G"
]

(Bad!)


A single string is okay. This:

console.log ("123456789A123456789B123456789C123456789D123456789E123456789F123456789G");

Yields:

123456789A123456789B123456789C123456789D123456789E123456789F123456789G

as expected.

But, arrays and objects get shortened.
How do I stop this behavior? Is this a bug? (My Google-Fu has failed, so far.)

Upvotes: 8

Views: 3626

Answers (3)

Brock Adams
Brock Adams

Reputation: 93553

Okay, after pawing through the list of Firebug Preferences (there's 204 of those, right now, and not in an apparent order), I found stringCropLength.

It defaults to 50, which makes sense, since the test strings were truncated to 123456789A123456789B123...89E123456789F123456789G, which is 49 characters long.

Opening about:config and setting extensions.firebug.stringCropLength to 0, stopped the strings from being truncated!

Note that according to Issue 5898: Introduce different string cropping preferences, this preference might affect a few things (for now). But, so far, I've seen no ill effects from having this set to no "cropping".

Upvotes: 9

devsathish
devsathish

Reputation: 2419

Use console.dir("....") function instead of console.log("...") Also u might be intersted to look at firebug preferences

Upvotes: 3

Ariel
Ariel

Reputation: 26783

Use console.dir instead of console.log - the output has a + near it which lets you expand the string.

Upvotes: 7

Related Questions