SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 341 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

We do that with a simple assignment statement like the following:
ActiveRecord::Base.logger = mylog
3. Set the logging level, and start logging your key events. The last step to proper logging is
to set the logging level you want your application to use and then, of course, to actually
denote what special situations to log.
Breaking down a simple example is probably the best way to show just how powerful and
helpful logging can be in your debugging (and code improvement) process. The following
example is a complete Active Record program that will manually log a couple of small events
we define as well as some background things that we may not have even realized were going
on (until we looked at the logs):
# Program to show ActiveRecord Logging in Action. (artest.rb)
require 'rubygems'
require_gem 'activerecord'
class Account < ActiveRecord::Base
set_table_name "accounts"
has_many :comments
end
class Comment < ActiveRecord::Base
set_table_name "comments"
belongs_to :account
end
ActiveRecord::Base.establish_connection(:adapter => "sqlserver",
:host => "mydbhost.


Pages:
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6