console.log() second argument onwards do not get saved to chrome_debug.log file
Reported by
nirap...@gmail.com,
Mar 25 2018
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0 Steps to reproduce the problem: 1. Save the attached index.html to your disk 2. run chrome : [your-path]/Chrome --enable-logging --v=1 3. close the browser 4. check chrome_debug.log What is the expected behavior? It should show : [67942:775:0325/010248.225294:INFO:CONSOLE(9)] "Do you see next two words", "hello world" source: file:///Users/gnirapad/web/debug/index.html (9) What went wrong? [67942:775:0325/010248.225294:INFO:CONSOLE(9)] "Do you see next two words", source: file:///Users/gnirapad/web/debug/index.html (9) Did this work before? N/A Chrome version: 65.0.3325.181 (Official Build) (64-bit) Channel: stable OS Version: OS X 10.12 Flash Version: Shockwave Flash 29.0 r0 This is a simple case I wrote to show the problem, the console.log() statement doesn't save anything other than the first argument to chrome_debug file. It shows up in browser developer tool though.
,
Mar 25 2018
Sorry, missed a step after step 2. Load/open the index.html file you downloaded. Thanks much.
,
Mar 25 2018
Judging by the source code Chrome only logs the first argument (m_message): https://cs.chromium.org/chromium/src/v8/src/inspector/v8-console-message.cc?l=234&rcl=191c7ea0470d227ca56b0122c0992d9618832d3a Can't it use V8ValueStringBuilder instead?
,
Mar 25 2018
I am a novice to this codebase, but didn't understand how that is contributing to "log-files" only ? Where exactly logic is differing for writing to log file ? It writes properly to browser console output, just that it drops the arguments while writing to chrome_debug.log. Where is that happening ?
,
Mar 26 2018
Do you plan to submit a patch? That link shows that only m_message is sent to the frontend where file logging is handled afterwards via event subscription. Browser console logging properly invokes V8ValueStringBuilder in V8ConsoleMessage::createForConsoleAPI.
,
Mar 26 2018
,
Mar 26 2018
I would love to submit the patch, let see see how soon I can do that.
,
Mar 27 2018
I am not sure that we would like to have this feature. We calculate message base on first argument and use it to dump message to terminal, for console inside DevTools we use more complicated logic which includes running special script which captures preview of the object. This preview requires some time and enabled only when DevTools is shown.
,
Mar 27 2018
I am not sure I understand, ignoring second parameters onwards in a console.log() statement is a bug to me. We are not calculating message based on first argument.We are taking only the first argument, ignoring rest.
,
Mar 30 2018
As workaround you can run following code before any JavaScript in the page:
let log = console.log;
console.log = function(...args) { for (let arg of args) { log(arg); }};
Message formatting code is located in v8-console.cc and v8-console-message.cc files inside V8, we send this message to blink at line: [1].
[1] https://cs.chromium.org/chromium/src/v8/src/inspector/v8-console-message.cc?rcl=336856688087b5b9c722526c5d9c730b6da6b295&l=418
,
Apr 4 2018
@Reporter: Please check the issue as per comment#10 and let us know if this works for you. Hence adding Needs-Feedback label. Thanks!
,
Apr 4 2018
Yes, this will work. But why wouldn't you want this fixed ? I do not have bandwidth right now, otherwise I would be happy to fix it.
,
Apr 4 2018
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Apr 5 2018
,
Apr 16 2018
--enable-logging is not an API that provides any guarantees regarding the console.log output. Please use remote debugging protocol for that. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 Deleted