On 11 Nov 2008, at 18:47, Jonathan Rochkind wrote:
> > > > In Rails2, what's the best way to customize the format of logger > output > in Rails? > > In Rails1, due to Rails weird monkey-patching of Logger, you couldn't > just subclass Logger and then set it as the logger to be used. Has > this > 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 > class Logger > def format_message(severity, timestamp, progname, msg) > # stuff to output messages just the way I want. > end > end > > However, oddly, in Rails2 this seems to have stopped having any effect > at all. The logger output is still uncustomized, Rails default. > > Any advice? Thanks in advance to Frederick if he pays attention to > this, > because so far he's the only one who both understands what I'm talking > about and pays attention to me :) I already owe you many beverages of > your choice, Frederick. > -- > 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 -~----------~----~----~----~------~----~------~--~---

