rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Common Logger Help
@ 2009-06-18  3:49 Greg Melton
  2009-06-18  5:54 ` Michael Fellinger
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Melton @ 2009-06-18  3:49 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 906 bytes --]

Is there anyway to configure the common logger to output to a file?

I can see one of the options when calling rackup is a placeholder for an
access log.

options = {:Port => 9292, :Host => "0.0.0.0", :AccessLog => []}

From what I can tell this isn't used anywhere.

I've tried this and it works up until you run a rackup app daemonized:

rackup config.ru > /full/path/file.log

Once daemonized the following lines are called:

    STDIN.reopen "/dev/null"
    STDOUT.reopen "/dev/null", "a"
    STDERR.reopen "/dev/null", "a"

I'm assuming this kills the outputing so it never reaches the log file. I
know the path is change to root during the daemonization.

I've experimented with commenting out the STDOUT line above and I've had
mixed results in different environments. I was hoping a solution existed
without having to touch the rack code base.

Any help would be greatly appreciated.

Thanks,
Greg

[-- Attachment #2: Type: text/html, Size: 1118 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Common Logger Help
  2009-06-18  3:49 Common Logger Help Greg Melton
@ 2009-06-18  5:54 ` Michael Fellinger
  2009-06-18 16:24   ` Greg Melton
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Fellinger @ 2009-06-18  5:54 UTC (permalink / raw)
  To: rack-devel


On Thu, Jun 18, 2009 at 12:49 PM, Greg Melton<gmelton@gmail.com> wrote:
> Is there anyway to configure the common logger to output to a file?

require 'logger'
use Rack::CommonLogger, Logger.new('/some/file/somewhere.log')

Hope that helps, didn't actually check it, but that's the general
direction you should go  :)

> I can see one of the options when calling rackup is a placeholder for an
> access log.
>
> options = {:Port => 9292, :Host => "0.0.0.0", :AccessLog => []}
>
> From what I can tell this isn't used anywhere.
>
> I've tried this and it works up until you run a rackup app daemonized:
>
> rackup config.ru > /full/path/file.log
>
> Once daemonized the following lines are called:
>
>     STDIN.reopen "/dev/null"
>     STDOUT.reopen "/dev/null", "a"
>     STDERR.reopen "/dev/null", "a"
>
> I'm assuming this kills the outputing so it never reaches the log file. I
> know the path is change to root during the daemonization.
>
> I've experimented with commenting out the STDOUT line above and I've had
> mixed results in different environments. I was hoping a solution existed
> without having to touch the rack code base.
>
> Any help would be greatly appreciated.
>
> Thanks,
> Greg

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Common Logger Help
  2009-06-18  5:54 ` Michael Fellinger
@ 2009-06-18 16:24   ` Greg Melton
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Melton @ 2009-06-18 16:24 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]

Thanks Michael! I noticed CommonLogger accepted a log param -- just wasn't
sure where to grab it from. I'll look into this today and let you know.

-greg

On Wed, Jun 17, 2009 at 10:54 PM, Michael Fellinger
<m.fellinger@gmail.com>wrote:

>
> On Thu, Jun 18, 2009 at 12:49 PM, Greg Melton<gmelton@gmail.com> wrote:
> > Is there anyway to configure the common logger to output to a file?
>
> require 'logger'
> use Rack::CommonLogger, Logger.new('/some/file/somewhere.log')
>
> Hope that helps, didn't actually check it, but that's the general
> direction you should go  :)
>
> > I can see one of the options when calling rackup is a placeholder for an
> > access log.
> >
> > options = {:Port => 9292, :Host => "0.0.0.0", :AccessLog => []}
> >
> > From what I can tell this isn't used anywhere.
> >
> > I've tried this and it works up until you run a rackup app daemonized:
> >
> > rackup config.ru > /full/path/file.log
> >
> > Once daemonized the following lines are called:
> >
> >     STDIN.reopen "/dev/null"
> >     STDOUT.reopen "/dev/null", "a"
> >     STDERR.reopen "/dev/null", "a"
> >
> > I'm assuming this kills the outputing so it never reaches the log file. I
> > know the path is change to root during the daemonization.
> >
> > I've experimented with commenting out the STDOUT line above and I've had
> > mixed results in different environments. I was hoping a solution existed
> > without having to touch the rack code base.
> >
> > Any help would be greatly appreciated.
> >
> > Thanks,
> > Greg
>

[-- Attachment #2: Type: text/html, Size: 2268 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-18 16:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-18  3:49 Common Logger Help Greg Melton
2009-06-18  5:54 ` Michael Fellinger
2009-06-18 16:24   ` Greg Melton

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