Jonathan,
On Jan 29, 5:21 pm, Jonathan R. <ruby-forum-incom…@andreas-
s.net> wrote:
Hi. I’m deploying a Rails app via a mongrel cluster. I have some
confusion about logging in a mongrel environment.
If you were using thin of FastCGI the behaviour would be the same.
Some of my mongrels seem to be dying unexpectedly. The .pid file is
Check log/production,log for unhandled exceptions.
still there, but the process isn’t. However, when I look at the
Yes, the PID will be left behind, restarting the process requires
cleaning it use:
–clean
http://paulgoscicki.com/archives/2008/03/mongrel_cluster-not-starting-after-hard-reboot/
mongrel.pid.log file for a mongrel that is no longer running–there’s
nothing there to indicate why it died.
And you won’t find it there, go to log/production.log
I’m confused as to what output ends up in the mongrel.pid.log vs what
ends up in production.log? Can anyone clear up how this works?
mongrel.pid.log is specific to mongrel internals
production.log is used by rails itself, is where the meat is
When I look at the production.log – I’m not sure if there’s anything
there to indicate why the mongrel died. There’s a whole lot of cruft in
Exceptions, any?
$ egrep ‘(ception|rror)’ log/production.log
the production log! In particular, there seem to be entries for every
single HTTP request, along with timing numbers. Is this actually useful
Yes, this is the default behaviour of Rails logger.
to have? Is there any way to turn that kind of logging off? Do I want
to?
Yes, youcan customize the logger output level to suit you needs, but I
find the dfault useful for troubleshooting.
My own logger.info(message) or logger.debug(message) seem to be in
production.log too, instead of the mongrel.pid.log. That’s to be
expected? I sort of expected that logger.info wouldn’t be output in a
Yes, that is fine.
production environment at all! And Rails-produced error messages and
In all frameworks/loggers I used, in Java and Ruby, INFO is logged in
production environment, it is really useful for troubleshooting or
fine tuning the app response times.
deprecation warnings seem to end up in the mongrel.pid.log–why do my
Deprecations are thrown by the MRI, not by the Rails app.
own log messages end up in production.log instead? What controls what
Because those mesasages are added to the default logger initialized by
Rails calling logger.level and this logger is configured to generate
the log/MODE.log file.
goes where? Are there ways to fine-tune this more usefully?
Sure, I would recommend The Rails Wayf rom Ovie, there you will
understand how Rails initializes, its relationship with webserves and
logging is also documented there.
And in addition to my logging questions, does anyone have any idea why
my mongrels might be silently dying?
Something is going wrong in you Rails app, maybe is a misbehaved
library, or code, Do you have a memory leak? Are there exception or
error in your logs? What kind of hosting are you using? Shared? VPS?
How much memory? How many monmgrels are running? Are you using Monit
or God to tace care of the processes? Rails forensics requires a LOT
more information.
Thanks for any advice,
Best regars and good luck,
–
Aníbal Rojas
http://anibal.rojas.com.ve