On 18 Nov 2008, at 00:18, Jonathan Rochkind wrote:

>
> Yeah, thanks. I found this patch, which adds formatter functionality  
> to
> BufferedLogger:
>
> http://rails.lighthouseapp.com/projects/8994/tickets/1307-bufferedlogger-should-support-message-formatting
>
> Using that as a guide, I have created a sub-class of BufferedLogger  
> that
> does what I want, until/unless that makes it into a future Rails
> release.
>
> But now I'm stuck figuring out how to tell Rails to use my new sub- 
> class
> (or an instantiation of it) of a BufferedLogger. Nothing I try to do
> seems to work. Setting RAILS_DEFAULT_LOGGER myself to my instantiated
> logger in environment.rb, no. Setting config.logger to my instantiated
> logger in environment.rb, no.
>
> Anyone figured out how to actually tell Rails2 to use a new logger
> object?

I just set

config.logger = SyslogLogger.new 'rails'
config.logger.level = Logger::INFO

from production.rb and that works fine.

Fred
>
>
> (Odd that it's taken so long to get logging right in Rails.)
>
> Jonathan
>
>
> Frederick Cheung wrote:
>> On 11 Nov 2008, at 18:47, Jonathan Rochkind wrote:
>>
>>> been improved in Rails2, is there a cleaner way to do this now?
>>>
>>> In Rails1, the only good way I found to customize the logger output
>>> was
>>> to myself monkey-patch Logger at the end of environment.rb, over-
>>> riding
>>> format_message:
>>>
>> Well if you look at the source to BufferedLogger in rails 2, the add
>> method (which is what the rest of rails appears to be calling) just
>> appends the message to the buffer. (or in other words looks like you
>> should be overriding add on ActiveSupport::BufferedLogger or subclass
>> that and set config.logger to an instance of your subclass)
>>
>> Fred
>
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to