How to fire an event when BrowserWindow logs a console message?


I’d like to get the event when the content of BrowserWindow logs a console message.

When we use a webView, ‘console-message’ event is fired when the guest window logs a console message like below.

webview.addEventListener('console-message', function(e) {
  console.log('Guest page logged a message:', e.message);

However, I could not find any way to get this event with the content of BrowserWindow.
Is it possible to get console messages logged in ‘’ in a below situation?

var BrowserWindow = require('browser-window');

var win = new BrowserWindow({ width: 800, height: 600, show: false });
win.on('closed', function() {
  win = null;


Thank you for your support!!


Same problem here. Want to get console message from webContents and can’t find anything helpful in the Doc


As far as I’m aware there’s no ‘official’ way of doing this, but I suppose you could override console.log using .executeJavaScript(<code>) and report it back that way.