Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Proposal: env["rack.logger"]
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  16 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Yehuda Katz  
View profile  
 More options Jul 27 2009, 3:11 pm
From: Yehuda Katz <wyc...@gmail.com>
Date: Mon, 27 Jul 2009 12:11:39 -0700
Local: Mon, Jul 27 2009 3:11 pm
Subject: Proposal: env["rack.logger"]

I'd like to suggest that a standard Ruby logger object be found in
env["rack.logger"].
This logger object should support:

logger.info
logger.debug
logger.warn
logger.error
logger.fatal

each of these objects should be able to take a block for deferred logging:

logger.info { some_expensive_operation (wont_be_run_in_warn_mode) }

We already do the latter in Merb (to skip expensive param processing in
production mode) and will be adding it to Rails as well -- it'd be nice to
standardize on it.

Thoughts?

--
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scytrin dai Kinthra  
View profile  
 More options Jul 27 2009, 3:49 pm
From: Scytrin dai Kinthra <scyt...@gmail.com>
Date: Mon, 27 Jul 2009 12:49:18 -0700
Local: Mon, Jul 27 2009 3:49 pm
Subject: Re: Proposal: env["rack.logger"]

I have been implementing a similar feature in quite a few of the stacks I've
been setting up, and it'd be nice to have a standard in the spec.
I would prefer we take the duck typing approach to the entry rather than the
type restraint, as long as the object supports the 5 methods (and possibly
#level for introspective purposes) it would be a valid rack.logger value.

stadik.net

On Jul 27, 2009 12:12 PM, "Yehuda Katz" <wyc...@gmail.com> wrote:

I'd like to suggest that a standard Ruby logger object be found in
env["rack.logger"].
This logger object should support:

logger.info
logger.debug
logger.warn
logger.error
logger.fatal

each of these objects should be able to take a block for deferred logging:

logger.info { some_expensive_operation (wont_be_run_in_warn_mode) }

We already do the latter in Merb (to skip expensive param processing in
production mode) and will be adding it to Rails as well -- it'd be nice to
standardize on it.

Thoughts?

--
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joshua Peek  
View profile  
 More options Jul 27 2009, 4:02 pm
From: Joshua Peek <j...@joshpeek.com>
Date: Mon, 27 Jul 2009 15:02:36 -0500
Local: Mon, Jul 27 2009 4:02 pm
Subject: Re: Proposal: env["rack.logger"]
+1

We should require servers to set a default logger so its *always*
available. Then Rails or other middleware down the stack can swap it
out with something else.

--
Joshua Peek


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel N  
View profile  
 More options Jul 27 2009, 5:14 pm
From: Daniel N <has....@gmail.com>
Date: Tue, 28 Jul 2009 07:14:47 +1000
Local: Mon, Jul 27 2009 5:14 pm
Subject: Re: Proposal: env["rack.logger"]

On Tue, Jul 28, 2009 at 6:02 AM, Joshua Peek <j...@joshpeek.com> wrote:

> +1

> We should require servers to set a default logger so its *always*
> available. Then Rails or other middleware down the stack can swap it
> out with something else.

> --
> Joshua Peek

+1 from me.  I like it.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scytrin dai Kinthra  
View profile  
 More options Jul 27 2009, 5:27 pm
From: Scytrin dai Kinthra <scyt...@gmail.com>
Date: Mon, 27 Jul 2009 14:27:03 -0700
Local: Mon, Jul 27 2009 5:27 pm
Subject: Re: Proposal: env["rack.logger"]

I would argue against a formal logger being required, but generating a
default of a wrapper around rack.error seems sufficient enough a default.

--
stadik.net

On Jul 27, 2009 1:07 PM, "Joshua Peek" <j...@joshpeek.com> wrote:

+1

We should require servers to set a default logger so its *always*
available. Then Rails or other middleware down the stack can swap it
out with something else.

--
Joshua Peek


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joshua Peek  
View profile  
 More options Jul 27 2009, 5:30 pm
From: Joshua Peek <j...@joshpeek.com>
Date: Mon, 27 Jul 2009 16:30:08 -0500
Local: Mon, Jul 27 2009 5:30 pm
Subject: Re: Proposal: env["rack.logger"]

On Mon, Jul 27, 2009 at 4:27 PM, Scytrin dai Kinthra<scyt...@gmail.com> wrote:
> I would argue against a formal logger being required, but generating a
> default of a wrapper around rack.error seems sufficient enough a default.

Thats a good idea.

I just want something to be in rack.logger so we don't have to nil
check and you can count on your message going somewhere.

--
Joshua Peek


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yehuda Katz  
View profile  
 More options Jul 27 2009, 5:39 pm
From: Yehuda Katz <wyc...@gmail.com>
Date: Mon, 27 Jul 2009 14:39:26 -0700
Local: Mon, Jul 27 2009 5:39 pm
Subject: Re: Proposal: env["rack.logger"]

On Mon, Jul 27, 2009 at 2:27 PM, Scytrin dai Kinthra <scyt...@gmail.com>wrote:

> I would argue against a formal logger being required, but generating a
> default of a wrapper around rack.error seems sufficient enough a default.

Yep. That was the thrust of my proposal :)

-- Yehuda

--
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joshua Peek  
View profile  
 More options Aug 3 2009, 12:27 pm
From: Joshua Peek <j...@joshpeek.com>
Date: Mon, 3 Aug 2009 09:27:59 -0700 (PDT)
Local: Mon, Aug 3 2009 12:27 pm
Subject: Re: Proposal: env["rack.logger"]
Waiting on comments from Chris.

Created a lighthouse ticket for this thread:
http://rack.lighthouseapp.com/projects/22435-rack/tickets/63-logger-spec


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Neukirchen  
View profile  
 More options Aug 3 2009, 6:17 pm
From: Christian Neukirchen <chneukirc...@gmail.com>
Date: Tue, 04 Aug 2009 00:17:38 +0200
Local: Mon, Aug 3 2009 6:17 pm
Subject: Re: Proposal: env["rack.logger"]

Joshua Peek <j...@joshpeek.com> writes:
> On Mon, Jul 27, 2009 at 4:27 PM, Scytrin dai Kinthra<scyt...@gmail.com> wrote:
>> I would argue against a formal logger being required, but generating a
>> default of a wrapper around rack.error seems sufficient enough a default.

> Thats a good idea.

> I just want something to be in rack.logger so we don't have to nil
> check and you can count on your message going somewhere.

+1, For 1.1

--
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Tucker  
View profile  
 More options Aug 3 2009, 7:21 pm
From: James Tucker <jftuc...@gmail.com>
Date: Tue, 4 Aug 2009 00:21:35 +0100
Local: Mon, Aug 3 2009 7:21 pm
Subject: Re: Proposal: env["rack.logger"]

On 3 Aug 2009, at 23:17, Christian Neukirchen wrote:

> Joshua Peek <j...@joshpeek.com> writes:

>> On Mon, Jul 27, 2009 at 4:27 PM, Scytrin dai Kinthra<scyt...@gmail.com
>> > wrote:
>>> I would argue against a formal logger being required, but  
>>> generating a
>>> default of a wrapper around rack.error seems sufficient enough a  
>>> default.

>> Thats a good idea.

>> I just want something to be in rack.logger so we don't have to nil
>> check and you can count on your message going somewhere.

+1, however, I would request please that some form of Null / No-Op  
logger is available in core for profile testing (IO sucks).

The 'deferred' spec I find harder to agree with off the bat, as I  
think it needs to be registered somewhere in the stack, or heavily  
coupled.

I have some questions, as a result (particularly to Yehuda):

  * Who implements the scheduling?
  * Who implements the running?
  * When is it run? (as per some spec definition)
  * Does it have to be the same process?

I'd envisage something along the lines of:

l = Rack::SyncLogger.new
l.info { .. happens immediately .. }

l = Merb::Logger.new
l.info { .. happens after the request .. }

l = Rack::NullLogger.new
l.info { .. happens immediately or after request ? .. }

l = Rack::Logger.new # default?
l.info { .. happens when? .. }

Maybe some deferred logging middleware, but rack doesn't really have  
this notion of "when done".

I could also be barking up the wrong tree, or maybe declarative is the  
answer?

l = Merb::Logger.new
l.schedule { |item| Merb.after_response(item) }

?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy Kemper  
View profile  
 More options Aug 3 2009, 7:55 pm
From: Jeremy Kemper <jer...@bitsweat.net>
Date: Mon, 3 Aug 2009 16:55:31 -0700
Local: Mon, Aug 3 2009 7:55 pm
Subject: Re: Proposal: env["rack.logger"]

Passing a block is a way of avoiding evaluating the argument when the
log level is higher, not a means to defer the logging itself.

I'd leave this "when is the block actually called?" behavior undefined.

jeremy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy Kemper  
View profile  
 More options Aug 3 2009, 7:57 pm
From: Jeremy Kemper <jer...@bitsweat.net>
Date: Mon, 3 Aug 2009 16:57:12 -0700
Local: Mon, Aug 3 2009 7:57 pm
Subject: Re: Proposal: env["rack.logger"]

On Mon, Jul 27, 2009 at 2:27 PM, Scytrin dai Kinthra<scyt...@gmail.com> wrote:
> I would argue against a formal logger being required, but generating a
> default of a wrapper around rack.error seems sufficient enough a default.

Who generates the default wrapper?

And if a middleware alters rack.errors, the default wrapper may break.
This is error prone.

jeremy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy Kemper  
View profile  
 More options Aug 3 2009, 8:02 pm
From: Jeremy Kemper <jer...@bitsweat.net>
Date: Mon, 3 Aug 2009 17:02:01 -0700
Local: Mon, Aug 3 2009 8:02 pm
Subject: Re: Proposal: env["rack.logger"]

On Mon, Jul 27, 2009 at 1:02 PM, Joshua Peek<j...@joshpeek.com> wrote:

> +1

> We should require servers to set a default logger so its *always*
> available. Then Rails or other middleware down the stack can swap it
> out with something else.

A little pushback: I dislike the trend of requiring more from the
environment for convenience. It's nice to rely on for a framework, but
it makes ad-hoc usage painful without an extra tool like MockRequest.

Having to tack on a superfluous { 'rack.input' => StringIO.new } was
bad enough. I feel like we're robbing Rack of some of its agility.

jeremy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yehuda Katz  
View profile  
 More options Aug 3 2009, 8:23 pm
From: Yehuda Katz <wyc...@gmail.com>
Date: Mon, 03 Aug 2009 17:23:54 -0700
Local: Mon, Aug 3 2009 8:23 pm
Subject: Re: Proposal: env["rack.logger"]

I tend to agree. I'd want the behavior to be defined if it exists, but
I'm not comfortable pushing another requirement onto servers.

-- Yehuda


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Neukirchen  
View profile  
 More options Aug 3 2009, 9:16 pm
From: Christian Neukirchen <chneukirc...@gmail.com>
Date: Tue, 04 Aug 2009 03:16:42 +0200
Local: Mon, Aug 3 2009 9:16 pm
Subject: Re: Proposal: env["rack.logger"]

Jeremy Kemper <jer...@bitsweat.net> writes:
> I feel like we're robbing Rack of some of its agility.

A valid point that deserves more thought.

--
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Tucker  
View profile  
 More options Aug 4 2009, 4:21 am
From: James Tucker <jftuc...@gmail.com>
Date: Tue, 4 Aug 2009 09:21:33 +0100
Local: Tues, Aug 4 2009 4:21 am
Subject: Re: Proposal: env["rack.logger"]

On 4 Aug 2009, at 00:55, Jeremy Kemper wrote:

> Passing a block is a way of avoiding evaluating the argument when the
> log level is higher, not a means to defer the logging itself.

Sorry, I was obviously mislead by the use of the term 'defer' in the OP.

> I'd leave this "when is the block actually called?" behavior  
> undefined.

Defined by the logger itself then? That seems reasonable, as long as  
there is some reasonable level of consistency in the implementations.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »