log4js-node / log4js-node/streamroller

should remove targetFile when targetFile is existing?

Aperta
#62 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
38
Fork
20
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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) { }`

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, node.js
Ambito
backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.