# Mongrel, logging, dying processes

**URL:** <https://www.ruby-forum.com/t/mongrel-logging-dying-processes/127504>\
**Category:** Deployment\
**Created:** [January 29, 2008, 10:21pm UTC](https://www.ruby-forum.com/t/mongrel-logging-dying-processes/127504 "2008-01-29T22:21:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [January 29, 2008, 10:21pm UTC](https://www.ruby-forum.com/t/mongrel-logging-dying-processes/127504/1 "2008-01-29T22:21:30Z")

</div>

Hi. I’m deploying a Rails app via a mongrel cluster. I have some  
confusion about logging in a mongrel environment.

Some of my mongrels seem to be dying unexpectedly. The .pid file is  
still there, but the process isn’t. However, when I look at the  
mongrel.pid.log file for a mongrel that is no longer running–there’s  
nothing there to indicate why it died.

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?

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  
the production log! In particular, there seem to be entries for every  
single HTTP request, along with timing numbers. Is this actually useful  
to have? Is there any way to turn that kind of logging off? Do I want  
to?

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  
production environment at all! And Rails-produced error messages and  
deprecation warnings seem to end up in the mongrel.pid.log–why do my  
own log messages end up in production.log instead? What controls what  
goes where? Are there ways to fine-tune this more usefully?

And in addition to my logging questions, does anyone have any idea why  
my mongrels might be silently dying?

Thanks for any advice,

Jonathan

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [July 9, 2008, 10:12pm UTC](https://www.ruby-forum.com/t/mongrel-logging-dying-processes/127504/2 "2008-07-09T22:12:29Z")

</div>

Jonathan R. wrote:

> And in addition to my logging questions, does anyone have any idea why  
> my mongrels might be silently dying?
> 
> Thanks for any advice,
> 
> Jonathan

I would love to know the answer to this, too, because I’m having the  
exact same trouble. Anyone know if this has already been answered  
elsewhere? This is an incredibly frustrating problem. Just some advice  
on how to log what is going on would be useful…

Thanks,  
Kris

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [July 9, 2008, 11:19pm UTC](https://www.ruby-forum.com/t/mongrel-logging-dying-processes/127504/3 "2008-07-09T23:19:51Z")

</div>

tail -f ./current/logs/mongrel.log

?

On Wed, Jul 9, 2008 at 1:12 PM, Kristopher Kelly  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> exact same trouble. Anyone know if this has already been answered  
> elsewhere? This is an incredibly frustrating problem. Just some advice  
> on how to log what is going on would be useful…
> 
> ## Thanks, Kris
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Anthony E.  
408-656-2473  
[http://anthony.ettinger.name](http://anthony.ettinger.name)

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [July 13, 2008, 5:20am UTC](https://www.ruby-forum.com/t/mongrel-logging-dying-processes/127504/4 "2008-07-13T05:20:32Z")

</div>

Hi,  
I have some idea about why mongrel is dying sometimes/most of the  
times.

```
Mongrel can handle the 256 request simultaneously at one time. if 

```

the  
incoming request is higher than 256, they have written code inside the \*  
mongrel.rb\* to increase the threads to handle the request. But they  
forgot  
to initialize the one variable called _‘w’_(i’m not sure the exact  
variable  
name but its one word) so that its not creating the extra threads to  
handle  
request and its crashing.

mongrel gets crashed becasue of the error this is the exact error :  
\*unintialized  
constant ‘w’

\*If you want to know about this please look into your log files which is  
reside in log folder.

Thanks,  
Sathish K. Sadhasivam.

On Thu, Jul 10, 2008 at 2:49 AM, Anthony E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [July 13, 2008, 7:27am UTC](https://www.ruby-forum.com/t/mongrel-logging-dying-processes/127504/5 "2008-07-13T07:27:25Z")

</div>

I wonder if its because my ISP only allows one instance of mongrel per  
application/proxy

I am not able to use mongrel\_cluster.

On Sat, Jul 12, 2008 at 8:20 PM, sathishkumar [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> mongrel gets crashed becasue of the error this is the exact error :
> 
> > > > 
> > > 
> > > Kris  
> > > 408-656-2473  
> > > [http://anthony.ettinger.name](http://anthony.ettinger.name)
> 
> >

–  
Anthony E.  
408-656-2473  
[http://anthony.ettinger.name](http://anthony.ettinger.name)

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [July 12, 2008, 2:23pm UTC](https://www.ruby-forum.com/t/mongrel-logging-dying-processes/127504/6 "2008-07-12T14:23:11Z")

</div>

Jonathan,

On Jan 29, 5:21 pm, Jonathan R. \<ruby-forum-incom…@andreas-  
[s.net](http://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/](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

> **[Home - Has Many Developers](https://hasmanydevelopers.com/)**
>
> We are the best choice for your building design and development

> **[RUBYCORNER.COM](https://www.rubycorner.com/)**
>
> RUBYCORNER.COM - Contact us for any business inquiries

[http://anibal.rojas.com.ve](http://anibal.rojas.com.ve)

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [November 26, 2010, 8:58pm UTC](https://www.ruby-forum.com/t/mongrel-logging-dying-processes/127504/7 "2010-11-26T20:58:17Z")

</div>

hi its seems like you have done a hard work on it. I have got lots of  
information from your post. Really appreciate your work.!! It was  
describe very nicely keep us doing good work…  
[Convert  
Cassette to CD](http://www.dealsourcedirect.com/ion-tape2pc.html/)  
[toy story  
lamp](http://www.dealsourcedirect.com/toy-story-lamp.html/)
