Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10580 (closed defect: fixed)

Opened 10 months ago

Last modified 10 months ago

[PATCH] fix log level comparison in AR::Base.benchmark

Reported by: dcmanges Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: benchmark logger
Cc:

Description

Currently, ActiveRecord::Base.benchmark will not log if you specify a log level higher than the current one. That means this benchmark will not be logged in a debug logger:

  ActiveRecord::Base.benchmark "Population", Logger::INFO do
    People.count
  end

Instead of logger.level == log_level it should compare as logger.level <= log_level.

I added a test for this and noticed that unit tests for both 'benchmark' and 'silence' were non-existent, so I added a little test coverage.

Attachments

10580_fix_benchmark_log_level_comparison.diff (3.8 kB) - added by dcmanges on 12/21/07 00:27:53.

Change History

12/21/07 00:27:53 changed by dcmanges

  • attachment 10580_fix_benchmark_log_level_comparison.diff added.

12/21/07 01:48:24 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

(In [8455]) Benchmark logs for any level below or equal to the one specified, rather than just equal. Closes #10580 [Dan Manges]