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.)
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.)
- possible duplicate of Firebug console shortening strings in array logged? – Ariel Commented Sep 28, 2012 at 8:27
3 Answers
Reset to default 9Okay, 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".
Use console.dir
instead of console.log
- the output has a + near it which lets you expand the string.
Use console.dir("....") function instead of console.log("...") Also u might be intersted to look at firebug preferences