LockerProject / Locker

Locker - the "me" platform
http://lockerproject.org/
BSD 3-Clause "New" or "Revised" License
1.07k stars 123 forks source link

Log output is lost on process.exit() #539

Open temas opened 12 years ago

temas commented 12 years ago

There's a potential that some logs are getting to stdout but not to the file log when enabled. This needs to be investigated, and is possibly at the winston level.

mdz commented 12 years ago

The following test code shows that if process.exit() is called, log output may be lost. In this case, it doesn't even create the file(!). Commenting out process.exit makes it work properly.

var winston = require('winston');

var logger = new (winston.Logger)({ transports: [ new (winston.transports.File)({'filename': '/tmp/test.log'}) ]});

logger.info('test'); process.exit(1);

mdz commented 12 years ago

https://github.com/flatiron/winston/issues/15

mdz commented 12 years ago

The combination of these two commits should help a bit, but there are still other places where we process.exit() which probably need to be audited.

commit 0f0b8751409f42c5324c364e98ffefd20ae3e249 Author: Matt Zimmerman mdz@singly.com Date: Wed Jan 11 18:42:09 2012 -0800

If a global migration fails, attempt a clean shutdown instead of bailing hard

commit 50d0e9033b8e357b79fb1f1ca3aacee1385c4e30 Author: Matt Zimmerman mdz@singly.com Date: Wed Jan 11 18:08:34 2012 -0800

Ensure that log output is flushed before (clean) shutdown
mdz commented 12 years ago

The winston callback stuff isn't working as intended, unfortunately