[Mongrel] mongrel becoming unresponsive

Luis Lavena luislavena at gmail.com
Tue May 8 10:06:43 EDT 2007


On 5/7/07, Pete DeLaurentis <pete at nextengine.com> wrote:
> Thanks for the tips Miles.  One of them really hit home:
>
> I love writing to stdout, and it's all over the place in my app.
> It's great because you can run your scripts / apps as foreground and
> get a live trace, or daemonized and it goes to the log file.  Your
> warning on this one sounds like the voice of experience, and I
> believe it.  But I'd like to understand the details.
>
> Any ideas why this is a dangerous thing to do?
>

Pete,

puts or anything that prints to stdout/stderr interfere with CGI
(Servlet dispatcher used by Rails).

Also, puts not being threadsafe (you cannot garantee "this line #1"
will get print fully form one thread and other text line from another
will without interfere eachother).


use RAILS_DEFAULT_LOGGER (or just 'logger' in your controllers, views
or models).

logger.debug (for debug level) is very helpful during development.


-- 
Luis Lavena
Multimedia systems
-
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi


More information about the Mongrel-users mailing list