3

I have created an Electron App(say MyApp). I have used electron-packager to pack the App. I installed the app in my local machine and I can see MyApp in the start menu. When I click on the Icon It launches the app but I am not able to debug it. I can see the devtool

Electron version : "^5.0.7"

Electron Packager: "^12.2.0" OS: Windows

Thanks in advance

Praveer Kumar
  • 912
  • 1
  • 12
  • 25
  • Did you ever find a solution to this? The best I've found is to use the npm package `electron-log`, which will allow you to write your main process log statements to a logfile. However, I am really trying to find a way to log regular `console.log` statements from my main process to a logfile, in production/packaged builds. Been trying to find a solution for a long time, but haven't found one as of yet. – bikz Oct 27 '22 at 15:38

1 Answers1

2

I think the best way debug your main process would be to do so during development, i have found the information here on the Electron docs to be very useful https://electronjs.org/docs/tutorial/debugging-main-process

Also my Code Editor of choice is VSCode so i was able to use this link https://electronjs.org/docs/tutorial/debugging-main-process-vscode

Its also good practice to have a Crash Reporter setup, Electron has the default one https://electronjs.org/docs/api/crash-reporter which also work great, but you can add other third party libraries like Bugsnag, Sentry or Backtrace.io.

Default Electron Crash Reporter

const { crashReporter } = require('electron')

crashReporter.start({
  productName: 'YourName',
  companyName: 'YourCompany',
  submitURL: 'https://your-domain.com/url-to-submit',
  uploadToServer: true
})

Using Sentry "You need an account for this option"


//You need to call init in your main and every renderer process you spawn. 
import * as Sentry from '@sentry/electron';
Sentry.init({dsn:'https://<your-key-here>@sentry.io/15...5'});
  • 1
    I see, But, I have a problem when I install the package. I was expecting my electronAapp to Spawn a background task – Praveer Kumar Aug 26 '19 at 07:02
  • @PraveerKumar I have found this article to be very helpful too for my production ready builds https://electronjs.org/docs/api/crash-reporter, i will update my answer with more details – Keith Ndhlovu Aug 26 '19 at 18:22