unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Cenon Del Rosario <cdelrosario@publishing.nine.com.au>
Cc: unicorn-public@yhbt.net
Subject: Re: Formatting unicorn logs in json format for $stderr
Date: Tue, 6 Jul 2021 23:38:18 +0000	[thread overview]
Message-ID: <20210706233818.GA11462@dcvr> (raw)
In-Reply-To: <CAKZvEvKvXh=_CD7qO2=VHOa4E5YQuvM+UsazvEzGQ1Z5dxM0tw@mail.gmail.com>

Cenon Del Rosario <cdelrosario@publishing.nine.com.au> wrote:
> > I suspect that needs "logger()" around it, like so:
> >     logger(Logger.new($stderr).tap do |newlgr|
> >       newlgr.formatter = JsonLogFormatter.new
> >     end)
> 
> Sorry for incomplete code snippets but yes I do have this (I was doing
> it for either stdout or stderr) and it did not make a difference.

OK, did you see my other paragraph about Rack::CommonLogger?
(reposted below)

> > > For the most part it works and I get the stdout and stderr in json but
> > > I also see some other non-json formatted messages, for example:
> > > {"time":"2021-07-06 17:14:01
> > > +1000","severity":"INFO","source":"","message":"Started GET \"/admin\"
> > > for 127.0.0.1 at 2021-07-06 17:14:01 +1000"}
> > > 127.0.0.1 - - [06/Jul/2021 17:14:01] "GET /admin HTTP/1.1" 301 102 0.4243
> >
> > I suspect one of those lines could be the result of
> > Rack::CommonLogger from RACK_ENV=deployment or similar
> > (which matched "rackup" defaults back in 2009).
> >
> > Personally, I always used something non-standard like "RACK_ENV=none"
> > to disable all default Rack middleware (--no-default-middleware
> > exists nowadays, too).

  reply	other threads:[~2021-07-06 23:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06  7:22 Cenon Del Rosario
2021-07-06 10:41 ` Eric Wong
2021-07-06 23:21   ` Cenon Del Rosario
2021-07-06 23:38     ` Eric Wong [this message]
2021-07-07  0:04       ` Cenon Del Rosario
2021-07-07  0:16         ` Eric Wong
2021-07-07  7:01           ` Cenon Del Rosario

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=20210706233818.GA11462@dcvr \
    --to=e@80x24.org \
    --cc=cdelrosario@publishing.nine.com.au \
    --cc=unicorn-public@yhbt.net \
    --subject='Re: Formatting unicorn logs in json format for $stderr' \
    /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

Code repositories for project(s) associated with this inbox:

	../../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).