log4js-node / log4js-node/streamroller

should remove targetFile when targetFile is existing?

Abierto
#62 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
JavaScript
Estrellas
38
Forks
20
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza por rastrear la ruta de rollover que llama a fs.move(sourceFilePath, targetFilePath, { overwrite: true }) y reproduce el caso multiproceso con disableClustering: true. Confirma el comportamiento cuando targetFilePath ya existe; la tarea estará completada cuando los rollovers concurrentes ya no sobrescriban el log renovado ni provoquen pérdida de logs.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, node.js
Área
backend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.