winstonjs/winston

File logging reconfiguration issue (Error: write after end)

Open

#1.573 geöffnet am 23. Jan. 2019

Auf GitHub ansehen
 (34 Kommentare) (18 Reaktionen) (0 zugewiesene Personen)JavaScript (1.789 Forks)batch import
BugGood First IssueHelp WantedImportant

Repository-Metriken

Stars
 (21.967 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 68T 4h) (9 gemergte PRs in 30 T)

Beschreibung

Please tell us about your environment:

  • winston version?
    • winston@2
    • [ X] winston@3
  • _node -v outputs:_v10.15.0
  • _Operating System?_Windows 10
  • _Language? JavaScript (pure Node)

What is the problem?

When logger is reconfigured, the open streams are destroyed and winston tries to write to an already destroyed stream.

I created a really simple playground to replicate it (less than 10 lines of actual code): https://github.com/peterbakonyi05/winston-log-rotate-reconfiguration-issue/blob/master/index.js

What do you expect to happen instead?

winston creates a new stream and handles reconfiguration.

Note

Alternatively, instead of reconfiguring winston a new instance can be created, in case someone else has the same issue. Just call .close on the old instance and create a new from scratch.

Contributor Guide