electron: console.log does not log to the dev tools console window

  • Electron version: debug version built from master (7e2f7602c1d3f383bb859f4af96e74e683a49d8e)
  • Operating system: win7 sp1 x64

Expected behavior

node --inspect-brk -e console.log('hello') logs to stdout and the dev tools console so one expects electron to do the same

Actual behavior

electron with attached dev tools only logs to stdout

How to reproduce

console_log.js with console.log('hello'); electron.exe --inspect-brk console_log.js

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 17 (10 by maintainers)

Most upvoted comments

This is painful, how are people debugging electron apps without repl working? Any workarounds?

I tested in 1.8.8 and it’s broken there too. It was working at some point, anyone know a version?

Edit: On OS X Mojave, tried 1.8.8, 2.0 latest and 3.0 latest beta.

Any update on this? Is there any workaround?

@m4heshd for issue with Electron 11 please update to 11.2.0 which got fixed by https://github.com/electron/electron/pull/27102

Same. Electron version v8.2.5, Win7 64. console.info works, but console.log doesn’t. So the workaround for now is:

console.log(`shouldn't work`)
console.log = console.info;
console.log('should work')

I can confirm this is happening in v6.0.x (namely v6.0.7) on Windows 10 (1809).

It also appears to not happen to console.info, but other console methods (like log, warn, and error) are afflicted. What makes that one special?

For example:

// index.js
console.log('log')
console.info('info')
.\node_modules\.bin\electron --inspect index.js
> 'info'

node --inspect index.js
> 'log'
> 'info'

Serves as a work-around I guess, but still annoying.

@bughit The problem with original implementation is, it would throw exception when stdout is not available. We should probably find out which call is actually printing the message to devtools and then invoke it.