Search code examples
ruby-on-railsruby-on-rails-3loggingrackunicorn

Rails::Rack:LogTailer and Unicorn


I'm switching from Thin to Unicorn. So far everything works and my tests are passing, but I'm not getting the useful log statements in my terminal. I have to tail log/development.log to see what actually happened.

I read http://dave.is/unicorn.html and was able to get it to work by diverting the log to STDOUT, but I'd like to be able to have my development log file as well, so I can grep it later.

How do I add Rails::Rack::LogTailer to get my log to also show up after I boot up my server?

Maybe I don't need Rails::Rack::LogTailer? I would like to not need to tail my log file after every request.

In case this is relevant ... I'm running Rails 3.2.13, Rack 1.4.5, and Unicorn 4.6.2.

--EDIT--

I tried adding this to the end of my config/environments/development.rb

config.middleware.insert_after(Rails::Rack::Logger, Rails::Rack::LogTailer, "/log/development.log")

But that didn't seem to have any effect.


Solution

  • Fix is very simple, delete leading "/".

    Change: "/log/development.log"
    To: "log/development.log"