0

I have created a Winston logger:

_logger.add(logger.transports.File, {
    filename: conf_fileName,
    timestamp:'true',
    maxsize: 1024,
    maxFiles: 2
});

But after couple of hours I have lot of files in size of ~2kb. Is there something wrong with the logger definition?

Adam Hopkinson
  • 28,281
  • 7
  • 65
  • 99
Nava Polak Onik
  • 1,509
  • 2
  • 13
  • 17

2 Answers2

3

The maxsize is in bytes - so you are limiting the logfiles to 1KB (which may be reported by your OS as 2KB).

If you want 1MB, try maxsize: 1048576

Adam Hopkinson
  • 28,281
  • 7
  • 65
  • 99
0

There is an issue where maxFiles and maxsize are both set where it does not honor your maxFiles setting.

See this issue on the issue tracker

codelark
  • 12,254
  • 1
  • 45
  • 49