Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop log writing (file and console transport) #438

Open
ivan-kzkv opened this issue Oct 6, 2024 · 4 comments
Open

Infinite loop log writing (file and console transport) #438

ivan-kzkv opened this issue Oct 6, 2024 · 4 comments

Comments

@ivan-kzkv
Copy link

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.

@megahertz
Copy link
Owner

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.

@ivan-kzkv
Copy link
Author

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.

@megahertz
Copy link
Owner

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.

@ivan-kzkv
Copy link
Author

ivan-kzkv commented Oct 7, 2024

I know, but it was done with my college and he found that issue and it's intresting to me how this works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants