Displaying 2 results from an estimated 2 matches for "old_format_message".
2005 Dec 16
2
Using logger from rails cron jobs
Hi. I''m trying to use logger from a rails cron job.
It works fine, but I''d like the standard ruby behavior of stamping each
log with date and time. How do I do this?
I''m trying:
# Set up out logging
require ''logger''
logger = Logger.new(STDERR)
logger.level = Logger::INFO
RAILS_DEFAULT_LOGGER = logger # Tell rails to log to our logger also
The
2006 Nov 10
0
Override logger for large binary data
...'tail -f log/development.log'' in a shell within emacs and it really
doesn''t like the huge lines dumped out during saves/updates.
So, I finally figured out that if I put the following in my
config/environment.rb I can trim the binary data dumps:
class Logger
private
alias old_format_message format_message
def format_message(severity, timestamp, progname, msg)
# uses a non-greedy match
msg.to_str.gsub!(/= x''(.*?)''(,|\s)/,''= x\''BINARY_DATA\''\2'')
"#{msg}\n"
end
end
But, I know that this is a kluge so any ad...