Ruby on Rails Tuesday, February 1, 2011

Hello,
I whish configure logger, adding a prefix in all "logger.error(..)", a
prefix like "ERROR------------------>", to be able, then to search in
log file, easily.

And to do that I had the idea of reopen Logger class, like this:

- In a file placed in \initializers\ I put

def initialize(args=nil)
super(args)
end
def error(msg)
super("ERROR------------>"+msg)
end
end

But this doesn't do anything, ¿ where do I have to put this code ?

- And if I put in config/environments/development.rb

config.logger = Logger.new(STDOUT)

raises an error: [super: no superclass method `error' for
#<Logger:0x3d7bae8>]

Could someone guide me for the right way? I'm absolutly lost.

What does usually people do to look for in the "great" production.log
file?

I know, if I put config.log_level = :warn, this file would be thin, but
I supose than this "info" messages are important to understand the whole
error.

Thanks a lot.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment