Infinite loop log writing (file and console transport)
Opened this issue · 4 comments
Sorry if it's silly question.
I have a project and set log methods through it.
in main.electron.ts file in global scope I have this kind of initialize procces and all work fine.
log.transports.file.level = 'info'; log.initialize(); log.transports.file.resolvePathFn = () => path.join(__dirname, '../dataDir/logs/main.log');
but when I try to save logs in project folder like this:
log.transports.file.level = 'info'; log.initialize(); log.transports.file.resolvePathFn = () => path.join(__dirname, '/logs/main.log');
any first log in my application start infinite loop of log writting. And I cant figure why its work like this.
Thanks for your answer.
Have you changed some other logger settings somewhere else? Or maybe you bound logger methods to the console or some other object?
I can't reproduce the issue even if I set another path to which the app has no access. I would appreciate it if you could make a test project that reproduces the issue.
It's legacy project I investigated it but didn't find any code that could affect this behaviour. I will try to make test project with controlled conditions.
BTW, usually, that's not a good idea to set the log file location to __dirname.
At least, it will work differently than expected when the app is packaged in many cases.
I know, but it was done with my college and he found that issue and it's intresting to me how this works