Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

should remove targetFile when targetFile is existing?

Open
#62 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, node.js
Domain
backend

Research direction

Start by tracing the rollover path that calls fs.move(sourceFilePath, targetFilePath, { overwrite: true }) and reproduce the disableClustering: true multi-process case. Confirm the behavior when targetFilePath already exists; done means concurrent rollovers no longer overwrite the renewed log or cause log loss.

Written by the indexing model from the issue text.

Description

when the current file should roll,the operation is
fs.move(sourceFilePath, targetFilePath, { overwrite: true });
this will delete target file if it exist.
But, in the mutli process app,when set disableClustering: true, all process will do the same operation. The first write log process will rename log.log to log.log.2020-01-01-01 and renew log.log. The next write log process will rename log.log that is renewed by first process to log.log.2020-01-01-01 too and this cause log loss.

So, when target file exists, should skip remove operation?
try { if (fs.existsSync(targetFilePath)) { return ; } await fs.move(sourceFilePath, targetFilePath, { overwrite: true }); } catch (e) { }

Dominant language
JavaScript
Stars
38
Forks
20
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from log4js-node/streamroller

All issues in log4js-node/streamroller

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.