Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Electron.js Desktop App Development

Lesson 17 of 28 · javascript

Debugging – DevTools, Remote Debugging & Logging

Duration: 9 mins

Debugging – DevTools, Remote Debugging & Logging

Open DevTools in a renderer window

win.webContents.openDevTools({ mode: 'detach' });

You can also enable it only in development:

if (!app.isPackaged) win.webContents.openDevTools();

Remote debugging (headless CI)

Launch Electron with the --remote-debugging-port flag:

electron . --remote-debugging-port=9222

Then connect from Chrome at http://localhost:9222.

Logging from the main process

const log = require('electron-log');
log.info('App started');
log.error('Oops');

The log file is saved to app.getPath('logs')/main.log.

Capture crashes

app.on('render-process-gone', (event, webContents, details) => {
  log.error(`Renderer crashed: ${details.reason}`);
});

Use the electron-debug module for hot‑reloading shortcuts during development.

Previous: Creating Installers – NSIS (Windows), DMG (macOS), AppImage (Linux)Next: Testing Electron Apps – Spectron & Playwright