log4js-node / log4js-node/streamroller
should remove targetFile when targetFile is existing?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 38
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
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) { }`
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
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.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100