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 | 60 | # FIXME |
| 61 | 61 | # task.send(:send_notification, :created) |
| 62 | 62 | rescue NotImplementedError => ex |
| 63 | - RAILS_DEFAULT_LOGGER.info ex.to_s | |
| 63 | + Rails.logger.info ex.to_s | |
| 64 | 64 | end |
| 65 | 65 | |
| 66 | 66 | begin |
| ... | ... | @@ -70,7 +70,7 @@ class Task < ActiveRecord::Base |
| 70 | 70 | # TaskMailer.deliver_target_notification(task, target_msg) |
| 71 | 71 | end |
| 72 | 72 | rescue NotImplementedError => ex |
| 73 | - RAILS_DEFAULT_LOGGER.info ex.to_s | |
| 73 | + Rails.logger.info ex.to_s | |
| 74 | 74 | end |
| 75 | 75 | end |
| 76 | 76 | end |
| ... | ... | @@ -91,7 +91,7 @@ class Task < ActiveRecord::Base |
| 91 | 91 | begin |
| 92 | 92 | send_notification(:finished) |
| 93 | 93 | rescue NotImplementedError => ex |
| 94 | - RAILS_DEFAULT_LOGGER.info ex.to_s | |
| 94 | + Rails.logger.info ex.to_s | |
| 95 | 95 | end |
| 96 | 96 | end |
| 97 | 97 | after_finish |
| ... | ... | @@ -119,7 +119,7 @@ class Task < ActiveRecord::Base |
| 119 | 119 | begin |
| 120 | 120 | send_notification(:cancelled) |
| 121 | 121 | rescue NotImplementedError => ex |
| 122 | - RAILS_DEFAULT_LOGGER.info ex.to_s | |
| 122 | + Rails.logger.info ex.to_s | |
| 123 | 123 | end |
| 124 | 124 | end |
| 125 | 125 | end |
| ... | ... | @@ -225,7 +225,7 @@ class Task < ActiveRecord::Base |
| 225 | 225 | # FIXME |
| 226 | 226 | # self.send(:send_notification, :activated) |
| 227 | 227 | rescue NotImplementedError => ex |
| 228 | - RAILS_DEFAULT_LOGGER.info ex.to_s | |
| 228 | + Rails.logger.info ex.to_s | |
| 229 | 229 | end |
| 230 | 230 | |
| 231 | 231 | begin |
| ... | ... | @@ -235,7 +235,7 @@ class Task < ActiveRecord::Base |
| 235 | 235 | # TaskMailer.deliver_target_notification(self, target_msg) |
| 236 | 236 | end |
| 237 | 237 | rescue NotImplementedError => ex |
| 238 | - RAILS_DEFAULT_LOGGER.info ex.to_s | |
| 238 | + Rails.logger.info ex.to_s | |
| 239 | 239 | end |
| 240 | 240 | end |
| 241 | 241 | ... | ... |
lib/feed_handler.rb
| ... | ... | @@ -51,7 +51,7 @@ class FeedHandler |
| 51 | 51 | end |
| 52 | 52 | |
| 53 | 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 | 55 | begin |
| 56 | 56 | container.class.transaction do |
| 57 | 57 | if container.update_errors > FeedHandler.max_errors && container.fetched_at < (Time.now - FeedHandler.disabled_period) |
| ... | ... | @@ -65,8 +65,8 @@ class FeedHandler |
| 65 | 65 | container.finish_fetch |
| 66 | 66 | end |
| 67 | 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 | 70 | container.reload |
| 71 | 71 | container.update_errors += 1 |
| 72 | 72 | container.error_message = exception.to_s |
| ... | ... | @@ -77,8 +77,8 @@ class FeedHandler |
| 77 | 77 | begin |
| 78 | 78 | container.finish_fetch |
| 79 | 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 | 82 | end |
| 83 | 83 | end |
| 84 | 84 | end | ... | ... |
script/task-notifier
| ... | ... | @@ -8,5 +8,5 @@ ActionController::Base.init_gettext 'noosfero' |
| 8 | 8 | Person.with_pending_tasks.each do |p| |
| 9 | 9 | set_locale_all p.last_lang |
| 10 | 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 | 12 | end | ... | ... |