4

I've created an electron application and bundled it using electron-builder. It all works great, though as this application is still in it's alpha stages there's a lot of debug that gets printed via console.log (in the backend of the application, not the frontend/renderer).

So my question is, as no terminal/command prompt gets opened with the application, where does all this logging go, and can I retrieve it to review where my application went wrong?

Thank you!

Nicster15
  • 159
  • 3
  • 12
  • I believe if you don't defined otherwise the log is lost in that case. Related: https://stackoverflow.com/a/10815271/2550156 – pergy Aug 16 '18 at 08:38

1 Answers1

4

There are two places where console.log output goes:

If you log in the renderer process, you can see it in the console in the browser window. If you open the dev tools programmatically you can see this console even after building.

If you log in the main process, you can see these messages if you start the intalled app or the unpacked binary via command line. In windows this would be the app.exe in the win-unpacked directory that electron-builder creates.

Another alternative would be a logger like electron-log that writes the log messages into a configured file.

Rhayene
  • 805
  • 9
  • 20
  • 1
    Thanks for this answer, Rhayene. For anyone on Windows who isn't sure how to do this, open cmd, navigate to the directory where you electron app exe is located, and run: `start "" yourapp.exe` You will see the console.log statements from your app's main.js on the command line. https://stackoverflow.com/questions/51103111/executing-exe-using-cmd-start-with-parameter – bikz Oct 01 '22 at 16:23