megahertz/electron-log

Electronforge + Webpack + preload.js script rise an error

xavier7179 opened this issue · 3 comments

Due to some issues with the logs working in the renderer with an electronforge-based app, I moved from version 4 to 5. Unfortunately, with the current setup, I cannot start the application because I always get the following error:

Error: electron-log isn't initialized in the main process. Please call log.initialize() before. Error invoking remote method '__ELECTRON_LOG__': No handler registered for '__ELECTRON_LOG__'

I though the problem was that the app was starting with a preload.js script to export some IPC to the renderer, but I checked all available documentation but needed help finding a working solution.

It should work fine with default settings. The only known case when it doesn't work is when using a custom session. Could you create a sample project that reproduces the issue?

I'm trying to... but it's not easy as I have a rather big and complex project, but I confirm that with the bare project out of the electronforge cli is working.

In my case, a further investigation clarifies that it works on the main process (I see a couple of logs I placed when the app starts) but then on the render it generates the error

Try to use the latest version. If that isn't helpful, please provide an example that reproduces the issue, and I'll reopen the issue.