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
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Debugging – DevTools | Electron.js Desktop App Development l | BraveProgrammer
  1. Courses
  2. /
  3. Electron.js Desktop App Development

Lesson 17 of 28

·javascript

Debugging – DevTools, Remote Debugging & Logging

9 mins

Course progress61%

What you'll learn

Keep these ideas in mind as you work through the lesson.

4 points
  • `win.webContents.openDevTools()` opens Chromium DevTools for a renderer window.
  • Use `--remote-debugging-port` to attach a debugger from another machine or CI.
  • `electron-log` gives you file‑based logging for the main process.
  • Listen to `render-process-gone` to detect and log renderer crashes.

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.

Make it stickPractice what you've learned1 quiz · 5 practical tests · Optional activities from Electron.js Desktop App DevelopmentBrowse activities
Previous lessonCreating Installers – NSIS (Windows), DMG (macOS), AppImage (Linux)Continue to lesson 18Testing Electron Apps – Spectron & PlaywrightBack to Electron.js Desktop App Development curriculum