Skip to content

Instantly share code, notes, and snippets.

@akm
Created October 25, 2009 07:08
Show Gist options
  • Save akm/217941 to your computer and use it in GitHub Desktop.
Save akm/217941 to your computer and use it in GitHub Desktop.
class FormatterWithThread < Logger::Formatter
Format = "%s %s, [%s#%d] %5s -- %s: %s\n"
def call(severity, time, progname, msg)
Format % [(Thread.current[:name] || Thread.current.object_id).to_s,
severity[0..0], format_datetime(time), $$, severity, progname,
msg2str(msg)]
end
end
ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), 'debug.log'))
ActiveRecord::Base.logger.formatter = FormatterWithThread.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment