Live data from Hacker News

Intel - nodejs logging that plays nice with console.log

seanmonstar.com

11–20 of 23 posts

Re: Intel - nodejs logging that plays nice with console.log

#11

Not directly related, but the author mentioned Winston, which made me think: who are these people using Node.js that don't need log rotation? Winston doesn't have built-in support. The only logging library I've found that supports this without extra effort is log4node.[1] [1] https://github.com/bpaquet/log4node

See https://github.com/trentm/node-bunyan

Re: Intel - nodejs logging that plays nice with console.log

#12
In case anyone is looking for a debug utility, not for archival logs, look no further than http://github.com/visionmedia/debug. Named loggers, nice formatting, easy to use and you get timers for free:

    require('debug')('controllers:something')
    debug('doing stuff', someObj)
then selectively enable it in the command-line with

    DEBUG=controllers:* node index.js
Express has debug built-in, so setting debug to express:* will turn on logging for it's internals. Just saying this 'cause I wish more tools came with built-in logging :)

Re: Intel - nodejs logging that plays nice with console.log

#13

Not directly related, but the author mentioned Winston, which made me think: who are these people using Node.js that don't need log rotation? Winston doesn't have built-in support. The only logging library I've found that supports this without extra effort is log4node.[1] [1] https://github.com/bpaquet/log4node

I plan to make a RotatingFile handler, but at the same time, what's wrong with Unix logrotate?

Re: Intel - nodejs logging that plays nice with console.log

#15

Not directly related, but the author mentioned Winston, which made me think: who are these people using Node.js that don't need log rotation? Winston doesn't have built-in support. The only logging library I've found that supports this without extra effort is log4node.[1] [1] https://github.com/bpaquet/log4node

We use winston-filerotatedate for winston logrotation.

Re: Intel - nodejs logging that plays nice with console.log

#17

Not directly related, but the author mentioned Winston, which made me think: who are these people using Node.js that don't need log rotation? Winston doesn't have built-in support. The only logging library I've found that supports this without extra effort is log4node.[1] [1] https://github.com/bpaquet/log4node

Why is your logging library handling log rotation? Also, not everyone logs to disk straight from process or at all.

Re: Intel - nodejs logging that plays nice with console.log

#19

Not directly related, but the author mentioned Winston, which made me think: who are these people using Node.js that don't need log rotation? Winston doesn't have built-in support. The only logging library I've found that supports this without extra effort is log4node.[1] [1] https://github.com/bpaquet/log4node

I plan to make a RotatingFile handler, but at the same time, what's wrong with Unix logrotate?

It's used in conjunction with logrotate.

Long-running programs will happily continue using the same file handle until they are signaled in some way to reopen the file path (usually in response to USR1 and HUP). See Nginx, Apache httpd, MongoDB, etc.

Post reply on HN