Skip to content

Commit

Permalink
push to Cloud-watch logs Testing (#682)
Browse files Browse the repository at this point in the history
* Cloudwatch logs

* fix logs

Update to remove depandacy of ENV var.

* Updated logging

* removed RAILS_LOG_TO_STDOUT dependancy

* Update aws_ssm.rb

* Update aws_ssm.rb

* Updated RAILS_LOG_TO_STDOUT

* Update aws_ssm.rb

* Create rollbar.rb

* Revert "Update aws_ssm.rb"

This reverts commit d48bcaf.
  • Loading branch information
mo-zag committed Feb 19, 2024
1 parent b44e31a commit 3c03ed8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true

if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end

# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
Expand Down
6 changes: 6 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr

if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end

# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
end
16 changes: 16 additions & 0 deletions config/initializers/rollbar.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'rollbar'

private

def config_rollbar
Rollbar.configure do |config|

config.access_token = ENV['ROLLBAR_ACCESS_TOKEN']
config.environment = ENV['ROLLBAR_ENVIRONMENT']

end
Rails.logger.info('App Deployed & Rollbar Successfully Configured')
Rollbar.info('App Deployed & Rollbar Successfully Configured')
end

config_rollbar if ENV['ROLLBAR_ACCESS_TOKEN'].present?

0 comments on commit 3c03ed8

Please sign in to comment.