Closed TimoKunze closed 4 months ago
Ok, forget about this: "If I don't override resolvePathFn
, I see both log entries in the standard log file." I have seen it in an older logfile, but cannot reproduce it anymore. So actually I never get the entries from the renderer process in any log file.
Meanwhile I've analyzed the code of electron-log and I think the reason for this issue is that log entries that come from the renderer, get a logger instance for which file transport is disabled. This would explain why I see the log entries from renderer in the system's console window.
Do you use multiple logger instances? If so, you should specify logId both in the main and renderer processes when creating an instance.
Well, I don't explicitly create instances. Instead I use the default instances that I get with import log from "electron-log/main";
and import log from "electron-log/renderer";
Is this not possible if logging to a file?
If you use only default instances it should work fine. I tried to reproduce the issue using your code, but it works fine for me. Could you make a demo project where this issue is reproduced?
I solved it. I did configure both loggers in a function in one module. This module therefore did import "electron-log/main" and "electron-log/renderer". Although there was no mix of which process type did access which logger, importing both loggers in the same module already was enough to cause problems.
Thank you for your support and also for this great project!
I'm using electron-log 5.1.1 with electron 29.0.1 and trying to log to a custom file. It works for the main process, but not for the renderer. This is my code:
In the log file I see only "Hello from main". If I don't override
resolvePathFn
, I see both log entries in the standard log file.What am I doing wrong? Timo