unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Cc: Serg Podtynnyi <serg@podtynnyi.com>
Subject: Re: Unicorn logging in production env
Date: Wed, 17 Aug 2011 09:58:35 +0000	[thread overview]
Message-ID: <20110817095835.GA13605@dcvr.yhbt.net> (raw)
In-Reply-To: <CAL3dLFqhcTcTc1dyZbL0hzHyg61NE+LX8Vh2Un3-Vzda--gV0Q@mail.gmail.com>

Serg Podtynnyi <serg@podtynnyi.com> wrote:
> I am asking about this default values because by the convention
> production env is 99% "production", but in the code I see
> "deployment", so most of the people that are using unicorn have bogus
> logs on production. Thanks for clogger suggestion.

Yeah, as I explained in the other post, I've always tried to base as
many defaults off Rack defaults so people have less trouble switching
from/to Unicorn.

I'm quite happy with how clogger works, hopefully we find more happy
users :)  (I don't like relying on unicorn to promote clogger, though.
clogger should be able to stand on its own since it works with any Rack
server).

> Any idea of how to have some kind of useful information when master
> process kills workers by timeout?

It's not possible to know what a worker is doing since SIGKILL isn't
trappable.  The master killing workers should only be a last resort
that'll let you limp by until you can have a proper fix.  The the rest
of the app should have local timeouts for all non-deterministic calls.

> We just monkey patched Unicorn::HttpParser read method like this
> https://gist.github.com/1151164 to get more info. Is there a better
> way to do this?

There isn't any difference between that and having Rack middleware
at the top of your stack (clogger logs at the end, and if you have
things like $body_bytes_sent it even wraps the response body)

class LogBefore < Struct.new(:app)
  def call(env)
    env["rack.logger"].debug env["REQUEST_PATH"]
  end
end
--------- config.ru ---------
use LogBefore
use ...
use ...
use ...
run YourApp.new
-----------------------------
-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


  reply	other threads:[~2011-08-17 10:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16 15:45 Unicorn logging in production env Serg Podtynnyi
2011-08-16 17:30 ` Eric Wong
2011-08-17  9:21   ` Serg Podtynnyi
2011-08-17  9:58     ` Eric Wong [this message]
2011-08-17 10:04       ` Eric Wong
2011-08-16 22:17 ` John Fieber
2011-08-17  0:45   ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110817095835.GA13605@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=mongrel-unicorn@rubyforge.org \
    --cc=serg@podtynnyi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).