Commit ccdb0565c63688cbf62edd9bffc4c86f512e8cc7
1 parent
9ea63965
Exists in
master
and in
27 other branches
rails3: change RAILS_DEFAULT_LOGGER constant to Rails.logger
Showing
3 changed files
with
12 additions
and
12 deletions
Show diff stats
app/models/task.rb
| @@ -60,7 +60,7 @@ class Task < ActiveRecord::Base | @@ -60,7 +60,7 @@ class Task < ActiveRecord::Base | ||
| 60 | # FIXME | 60 | # FIXME |
| 61 | # task.send(:send_notification, :created) | 61 | # task.send(:send_notification, :created) |
| 62 | rescue NotImplementedError => ex | 62 | rescue NotImplementedError => ex |
| 63 | - RAILS_DEFAULT_LOGGER.info ex.to_s | 63 | + Rails.logger.info ex.to_s |
| 64 | end | 64 | end |
| 65 | 65 | ||
| 66 | begin | 66 | begin |
| @@ -70,7 +70,7 @@ class Task < ActiveRecord::Base | @@ -70,7 +70,7 @@ class Task < ActiveRecord::Base | ||
| 70 | # TaskMailer.deliver_target_notification(task, target_msg) | 70 | # TaskMailer.deliver_target_notification(task, target_msg) |
| 71 | end | 71 | end |
| 72 | rescue NotImplementedError => ex | 72 | rescue NotImplementedError => ex |
| 73 | - RAILS_DEFAULT_LOGGER.info ex.to_s | 73 | + Rails.logger.info ex.to_s |
| 74 | end | 74 | end |
| 75 | end | 75 | end |
| 76 | end | 76 | end |
| @@ -91,7 +91,7 @@ class Task < ActiveRecord::Base | @@ -91,7 +91,7 @@ class Task < ActiveRecord::Base | ||
| 91 | begin | 91 | begin |
| 92 | send_notification(:finished) | 92 | send_notification(:finished) |
| 93 | rescue NotImplementedError => ex | 93 | rescue NotImplementedError => ex |
| 94 | - RAILS_DEFAULT_LOGGER.info ex.to_s | 94 | + Rails.logger.info ex.to_s |
| 95 | end | 95 | end |
| 96 | end | 96 | end |
| 97 | after_finish | 97 | after_finish |
| @@ -119,7 +119,7 @@ class Task < ActiveRecord::Base | @@ -119,7 +119,7 @@ class Task < ActiveRecord::Base | ||
| 119 | begin | 119 | begin |
| 120 | send_notification(:cancelled) | 120 | send_notification(:cancelled) |
| 121 | rescue NotImplementedError => ex | 121 | rescue NotImplementedError => ex |
| 122 | - RAILS_DEFAULT_LOGGER.info ex.to_s | 122 | + Rails.logger.info ex.to_s |
| 123 | end | 123 | end |
| 124 | end | 124 | end |
| 125 | end | 125 | end |
| @@ -225,7 +225,7 @@ class Task < ActiveRecord::Base | @@ -225,7 +225,7 @@ class Task < ActiveRecord::Base | ||
| 225 | # FIXME | 225 | # FIXME |
| 226 | # self.send(:send_notification, :activated) | 226 | # self.send(:send_notification, :activated) |
| 227 | rescue NotImplementedError => ex | 227 | rescue NotImplementedError => ex |
| 228 | - RAILS_DEFAULT_LOGGER.info ex.to_s | 228 | + Rails.logger.info ex.to_s |
| 229 | end | 229 | end |
| 230 | 230 | ||
| 231 | begin | 231 | begin |
| @@ -235,7 +235,7 @@ class Task < ActiveRecord::Base | @@ -235,7 +235,7 @@ class Task < ActiveRecord::Base | ||
| 235 | # TaskMailer.deliver_target_notification(self, target_msg) | 235 | # TaskMailer.deliver_target_notification(self, target_msg) |
| 236 | end | 236 | end |
| 237 | rescue NotImplementedError => ex | 237 | rescue NotImplementedError => ex |
| 238 | - RAILS_DEFAULT_LOGGER.info ex.to_s | 238 | + Rails.logger.info ex.to_s |
| 239 | end | 239 | end |
| 240 | end | 240 | end |
| 241 | 241 |
lib/feed_handler.rb
| @@ -51,7 +51,7 @@ class FeedHandler | @@ -51,7 +51,7 @@ class FeedHandler | ||
| 51 | end | 51 | end |
| 52 | 52 | ||
| 53 | def process(container) | 53 | def process(container) |
| 54 | - RAILS_DEFAULT_LOGGER.info("Processing %s with id = %d" % [container.class.name, container.id]) | 54 | + Rails.logger.info("Processing %s with id = %d" % [container.class.name, container.id]) |
| 55 | begin | 55 | begin |
| 56 | container.class.transaction do | 56 | container.class.transaction do |
| 57 | if container.update_errors > FeedHandler.max_errors && container.fetched_at < (Time.now - FeedHandler.disabled_period) | 57 | if container.update_errors > FeedHandler.max_errors && container.fetched_at < (Time.now - FeedHandler.disabled_period) |
| @@ -65,8 +65,8 @@ class FeedHandler | @@ -65,8 +65,8 @@ class FeedHandler | ||
| 65 | container.finish_fetch | 65 | container.finish_fetch |
| 66 | end | 66 | end |
| 67 | rescue Exception => exception | 67 | rescue Exception => exception |
| 68 | - RAILS_DEFAULT_LOGGER.warn("Unknown error from %s ID %d\n%s" % [container.class.name, container.id, exception.to_s]) | ||
| 69 | - RAILS_DEFAULT_LOGGER.warn("Backtrace:\n%s" % exception.backtrace.join("\n")) | 68 | + Rails.logger.warn("Unknown error from %s ID %d\n%s" % [container.class.name, container.id, exception.to_s]) |
| 69 | + Rails.logger.warn("Backtrace:\n%s" % exception.backtrace.join("\n")) | ||
| 70 | container.reload | 70 | container.reload |
| 71 | container.update_errors += 1 | 71 | container.update_errors += 1 |
| 72 | container.error_message = exception.to_s | 72 | container.error_message = exception.to_s |
| @@ -77,8 +77,8 @@ class FeedHandler | @@ -77,8 +77,8 @@ class FeedHandler | ||
| 77 | begin | 77 | begin |
| 78 | container.finish_fetch | 78 | container.finish_fetch |
| 79 | rescue Exception => finish_fetch_exception | 79 | rescue Exception => finish_fetch_exception |
| 80 | - RAILS_DEFAULT_LOGGER.warn("Unable to finish fetch from %s ID %d\n%s" % [container.class.name, container.id, finish_fetch_exception.to_s]) | ||
| 81 | - RAILS_DEFAULT_LOGGER.warn("Backtrace:\n%s" % finish_fetch_exception.backtrace.join("\n")) | 80 | + Rails.logger.warn("Unable to finish fetch from %s ID %d\n%s" % [container.class.name, container.id, finish_fetch_exception.to_s]) |
| 81 | + Rails.logger.warn("Backtrace:\n%s" % finish_fetch_exception.backtrace.join("\n")) | ||
| 82 | end | 82 | end |
| 83 | end | 83 | end |
| 84 | end | 84 | end |
script/task-notifier
| @@ -8,5 +8,5 @@ ActionController::Base.init_gettext 'noosfero' | @@ -8,5 +8,5 @@ ActionController::Base.init_gettext 'noosfero' | ||
| 8 | Person.with_pending_tasks.each do |p| | 8 | Person.with_pending_tasks.each do |p| |
| 9 | set_locale_all p.last_lang | 9 | set_locale_all p.last_lang |
| 10 | PendingTaskNotifier.deliver_notification(p) | 10 | PendingTaskNotifier.deliver_notification(p) |
| 11 | - RAILS_DEFAULT_LOGGER.info('deliver notification for ' + p.identifier) | 11 | + Rails.logger.info('deliver notification for ' + p.identifier) |
| 12 | end | 12 | end |