"Dowd, Stephen" <[email protected]> wrote:
> I'd like to control the size and on disk layout of the unicorn error
> and output logs.   Basically I want ruby Logger like functionality
> where I can specify a fixed # of rolling logs each of which is limited
> to # mb in size.   Not sure how to do this in unicorn.rb. 

You can also use the "logger" directive to avoid using the default
Logger (which goes to $stderr) instead:

http://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-logger

You'll also need to reconfigure Rack::CommonLogger and/or whatever
logger your framework (e.g. Rails/Sinatra) uses.

In modern versions of Ruby, the Logger class also seems multi-process
aware when doing its internal logrotation.

There is also SyslogLogger RubyGem which provides a Logger interface but
goes directly to syslog.

> My unicorn.conf file has basically the defaults, with the exception of:
> 
> Stderr_path "/log/unicorn/stderr.log"
> Stdout_path "/log/unicorn/stdout.log"
 
> These files will grow to the point where the disk becomes full at
> which point we begin to see failures.   

I prefer to log to files and use logrotate using a config as in
http://unicorn.bogomips.org/examples/logrotate.conf as Ben pointed out.

But you can also point those to FIFO + chronolog as Hleb pointed out,
too.  That might be a little slower because of the context switches
and synchronous wakeups.

Reply via email to