log4js-node icon indicating copy to clipboard operation
log4js-node copied to clipboard

Does not recreate the log file when after it is initialized once.

Open ladymalie opened this issue 11 years ago • 3 comments

There seems to be a problem when I tried to delete a log file generated after the start-up of my application. What happens is that when I delete the log file while the application is running, a new log file is not created.

inside my app.js

var log4js = require('log4js');
var JSON_CONFIG_PATH = __dirname + '/config/log4js-config.json';
log4js.configure(JSON_CONFIG_PATH);

log4js.getLogger('app');

while inside my log4js-config.json

{
"appenders": [
      {
          "type": "file",
          "filename": "../logs/log_file.log",
          "maxLogSize": 20480,
          "backups": 3,
          "category" : "server" 
      },
      {
          "type": "console"
      }
  ],

  "levels": {
    "[all]":  "INFO"
  }
}

ladymalie avatar Jul 29 '15 10:07 ladymalie

Yep, that sounds likely. I've never tested what happens in that scenario. Most likely log4js has a reference to a file handle that does not exist - I would have thought you'd get some errors when it tries to write to the file?

nomiddlename avatar Jul 29 '15 20:07 nomiddlename

Apparently, no errors were displayed anywhere.

ladymalie avatar Jul 30 '15 01:07 ladymalie

Closing this one as I'm not sure what the correct behaviour is here. Feel free to re-open if this scenario is important.

nomiddlename avatar Jul 08 '17 04:07 nomiddlename