diff --git a/app/builders/contact_builder.rb b/app/builders/contact_builder.rb index 14f26aa82..b63d72627 100644 --- a/app/builders/contact_builder.rb +++ b/app/builders/contact_builder.rb @@ -70,7 +70,7 @@ class ContactBuilder update_contact_avatar(contact) contact_inbox rescue StandardError => e - Rails.logger.info e + Rails.logger.error e raise e end end diff --git a/app/builders/messages/facebook/message_builder.rb b/app/builders/messages/facebook/message_builder.rb index 5410aa3c4..204b452d6 100644 --- a/app/builders/messages/facebook/message_builder.rb +++ b/app/builders/messages/facebook/message_builder.rb @@ -27,7 +27,7 @@ class Messages::Facebook::MessageBuilder < Messages::Messenger::MessageBuilder end ensure_contact_avatar rescue Koala::Facebook::AuthenticationError - Rails.logger.info "Facebook Authorization expired for Inbox #{@inbox.id}" + Rails.logger.error "Facebook Authorization expired for Inbox #{@inbox.id}" rescue StandardError => e Sentry.capture_exception(e) true diff --git a/app/controllers/api/v1/accounts/callbacks_controller.rb b/app/controllers/api/v1/accounts/callbacks_controller.rb index 7c2469c05..842930874 100644 --- a/app/controllers/api/v1/accounts/callbacks_controller.rb +++ b/app/controllers/api/v1/accounts/callbacks_controller.rb @@ -77,7 +77,7 @@ class Api::V1::Accounts::CallbacksController < Api::V1::Accounts::BaseController koala = Koala::Facebook::OAuth.new(GlobalConfigService.load('FB_APP_ID', ''), GlobalConfigService.load('FB_APP_SECRET', '')) koala.exchange_access_token_info(omniauth_token)['access_token'] rescue StandardError => e - Rails.logger.info e + Rails.logger.error e end def mark_already_existing_facebook_pages(data) diff --git a/app/controllers/twitter/callbacks_controller.rb b/app/controllers/twitter/callbacks_controller.rb index d484b0871..32fffbceb 100644 --- a/app/controllers/twitter/callbacks_controller.rb +++ b/app/controllers/twitter/callbacks_controller.rb @@ -14,7 +14,7 @@ class Twitter::CallbacksController < Twitter::BaseController redirect_to app_twitter_inbox_agents_url(account_id: account.id, inbox_id: inbox.id) end rescue StandardError => e - Rails.logger.info e + Rails.logger.error e redirect_to twitter_app_redirect_url end diff --git a/app/controllers/webhooks/instagram_controller.rb b/app/controllers/webhooks/instagram_controller.rb index 2338ca7d1..e6fe93566 100644 --- a/app/controllers/webhooks/instagram_controller.rb +++ b/app/controllers/webhooks/instagram_controller.rb @@ -17,7 +17,7 @@ class Webhooks::InstagramController < ApplicationController ::Webhooks::InstagramEventsJob.perform_later(params.to_unsafe_hash[:entry]) render json: :ok else - Rails.logger.info("Message is not received from the instagram webhook event: #{params['object']}") + Rails.logger.warn("Message is not received from the instagram webhook event: #{params['object']}") head :unprocessable_entity end end diff --git a/app/jobs/contact_avatar_job.rb b/app/jobs/contact_avatar_job.rb index 4f0550632..13725f562 100644 --- a/app/jobs/contact_avatar_job.rb +++ b/app/jobs/contact_avatar_job.rb @@ -8,6 +8,6 @@ class ContactAvatarJob < ApplicationJob ) contact.avatar.attach(io: avatar_file, filename: avatar_file.original_filename, content_type: avatar_file.content_type) rescue Down::Error => e - Rails.logger.info "Exception: invalid avatar url #{avatar_url} : #{e.message}" + Rails.logger.error "Exception: invalid avatar url #{avatar_url} : #{e.message}" end end diff --git a/app/jobs/contact_ip_lookup_job.rb b/app/jobs/contact_ip_lookup_job.rb index 22ced17fe..0403df537 100644 --- a/app/jobs/contact_ip_lookup_job.rb +++ b/app/jobs/contact_ip_lookup_job.rb @@ -8,7 +8,7 @@ class ContactIpLookupJob < ApplicationJob update_contact_location_from_ip(contact) rescue Errno::ETIMEDOUT => e - Rails.logger.info "Exception: ip resolution failed : #{e.message}" + Rails.logger.warn "Exception: ip resolution failed : #{e.message}" end private diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 9d5fd0214..58f12e4b5 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -25,8 +25,8 @@ class ApplicationMailer < ActionMailer::Base private def handle_smtp_exceptions(message) - Rails.logger.info 'Failed to send Email' - Rails.logger.info "Exception: #{message}" + Rails.logger.warn 'Failed to send Email' + Rails.logger.error "Exception: #{message}" end def send_mail_with_liquid(*args) diff --git a/app/models/channel/facebook_page.rb b/app/models/channel/facebook_page.rb index 6735d5e35..bed88e575 100644 --- a/app/models/channel/facebook_page.rb +++ b/app/models/channel/facebook_page.rb @@ -45,7 +45,7 @@ class Channel::FacebookPage < ApplicationRecord source_id: instagram_id ) rescue StandardError => e - Rails.logger.info e + Rails.logger.error e end end diff --git a/app/models/channel/twitter_profile.rb b/app/models/channel/twitter_profile.rb index baf3b992e..4f6fa7ba1 100644 --- a/app/models/channel/twitter_profile.rb +++ b/app/models/channel/twitter_profile.rb @@ -40,7 +40,7 @@ class Channel::TwitterProfile < ApplicationRecord source_id: profile_id ) rescue StandardError => e - Rails.logger.info e + Rails.logger.error e end end @@ -62,6 +62,6 @@ class Channel::TwitterProfile < ApplicationRecord unsubscribe_response = twitter_client.remove_subscription(user_id: profile_id) Rails.logger.info "TWITTER_UNSUBSCRIBE: #{unsubscribe_response.body}" rescue StandardError => e - Rails.logger.info e + Rails.logger.error e end end diff --git a/app/models/channel/web_widget.rb b/app/models/channel/web_widget.rb index 7c3edcc77..949b562be 100644 --- a/app/models/channel/web_widget.rb +++ b/app/models/channel/web_widget.rb @@ -86,7 +86,7 @@ class Channel::WebWidget < ApplicationRecord ) contact_inbox rescue StandardError => e - Rails.logger.info e + Rails.logger.error e end end end diff --git a/app/services/instagram/send_on_instagram_service.rb b/app/services/instagram/send_on_instagram_service.rb index 8dfaf43ec..f57fdd8ea 100644 --- a/app/services/instagram/send_on_instagram_service.rb +++ b/app/services/instagram/send_on_instagram_service.rb @@ -62,7 +62,7 @@ class Instagram::SendOnInstagramService < Base::SendOnChannelService query: query ) - Rails.logger.info("Instagram response: #{response['error']} : #{message_content}") if response['error'] + Rails.logger.error("Instagram response: #{response['error']} : #{message_content}") if response['error'] message.update!(source_id: response['message_id']) if response['message_id'].present? response diff --git a/app/services/notification/push_notification_service.rb b/app/services/notification/push_notification_service.rb index d0413a1d3..a083eb48c 100644 --- a/app/services/notification/push_notification_service.rb +++ b/app/services/notification/push_notification_service.rb @@ -66,7 +66,7 @@ class Notification::PushNotificationService rescue Webpush::ExpiredSubscription subscription.destroy! rescue Errno::ECONNRESET, Net::OpenTimeout, Net::ReadTimeout => e - Rails.logger.info "Webpush operation error: #{e.message}" + Rails.logger.error "Webpush operation error: #{e.message}" end def send_fcm_push(subscription) diff --git a/app/services/twilio/webhook_setup_service.rb b/app/services/twilio/webhook_setup_service.rb index 21ac1750b..4df40d601 100644 --- a/app/services/twilio/webhook_setup_service.rb +++ b/app/services/twilio/webhook_setup_service.rb @@ -5,14 +5,14 @@ class Twilio::WebhookSetupService def perform if phone_numbers.empty? - Rails.logger.info "TWILIO_PHONE_NUMBER_NOT_FOUND: #{channel.phone_number}" + Rails.logger.warn "TWILIO_PHONE_NUMBER_NOT_FOUND: #{channel.phone_number}" else twilio_client .incoming_phone_numbers(phonenumber_sid) .update(sms_method: 'POST', sms_url: twilio_callback_index_url) end rescue Twilio::REST::TwilioError => e - Rails.logger.info "TWILIO_FAILURE: #{e.message}" + Rails.logger.error "TWILIO_FAILURE: #{e.message}" end private diff --git a/app/services/twitter/send_on_twitter_service.rb b/app/services/twitter/send_on_twitter_service.rb index 16e081772..76ee29dbc 100644 --- a/app/services/twitter/send_on_twitter_service.rb +++ b/app/services/twitter/send_on_twitter_service.rb @@ -58,7 +58,7 @@ class Twitter::SendOnTwitterService < Base::SendOnChannelService tweet_data = response.body message.update!(source_id: tweet_data['id_str']) else - Rails.logger.info "TWITTER_TWEET_REPLY_ERROR #{response.body}" + Rails.logger.error "TWITTER_TWEET_REPLY_ERROR #{response.body}" end end end diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index 87deded55..adefee312 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -91,7 +91,7 @@ end # Log blocked events ActiveSupport::Notifications.subscribe('throttle.rack_attack') do |_name, _start, _finish, _request_id, payload| - Rails.logger.info "[Rack::Attack][Blocked] remote_ip: \"#{payload[:request].remote_ip}\", path: \"#{payload[:request].path}\"" + Rails.logger.warn "[Rack::Attack][Blocked] remote_ip: \"#{payload[:request].remote_ip}\", path: \"#{payload[:request].path}\"" end Rack::Attack.enabled = Rails.env.production? ? ActiveModel::Type::Boolean.new.cast(ENV.fetch('ENABLE_RACK_ATTACK', true)) : false diff --git a/lib/chatwoot_hub.rb b/lib/chatwoot_hub.rb index c8ef38de0..655060c7e 100644 --- a/lib/chatwoot_hub.rb +++ b/lib/chatwoot_hub.rb @@ -39,7 +39,7 @@ class ChatwootHub response = RestClient.post(PING_URL, info.to_json, { content_type: :json, accept: :json }) version = JSON.parse(response)['version'] rescue *ExceptionList::REST_CLIENT_EXCEPTIONS => e - Rails.logger.info "Exception: #{e.message}" + Rails.logger.error "Exception: #{e.message}" rescue StandardError => e Sentry.capture_exception(e) end @@ -50,7 +50,7 @@ class ChatwootHub info = { company_name: company_name, owner_name: owner_name, owner_email: owner_email, subscribed_to_mailers: true } RestClient.post(REGISTRATION_URL, info.merge(instance_config).to_json, { content_type: :json, accept: :json }) rescue *ExceptionList::REST_CLIENT_EXCEPTIONS => e - Rails.logger.info "Exception: #{e.message}" + Rails.logger.error "Exception: #{e.message}" rescue StandardError => e Sentry.capture_exception(e) end @@ -59,7 +59,7 @@ class ChatwootHub info = { fcm_token_list: fcm_token_list, fcm_options: fcm_options } RestClient.post(PUSH_NOTIFICATION_URL, info.merge(instance_config).to_json, { content_type: :json, accept: :json }) rescue *ExceptionList::REST_CLIENT_EXCEPTIONS => e - Rails.logger.info "Exception: #{e.message}" + Rails.logger.error "Exception: #{e.message}" rescue StandardError => e Sentry.capture_exception(e) end @@ -70,7 +70,7 @@ class ChatwootHub info = { event_name: event_name, event_data: event_data } RestClient.post(EVENTS_URL, info.merge(instance_config).to_json, { content_type: :json, accept: :json }) rescue *ExceptionList::REST_CLIENT_EXCEPTIONS => e - Rails.logger.info "Exception: #{e.message}" + Rails.logger.error "Exception: #{e.message}" rescue StandardError => e Sentry.capture_exception(e) end diff --git a/lib/integrations/slack/send_on_slack_service.rb b/lib/integrations/slack/send_on_slack_service.rb index 6f780ae38..1eb91b3ea 100644 --- a/lib/integrations/slack/send_on_slack_service.rb +++ b/lib/integrations/slack/send_on_slack_service.rb @@ -48,7 +48,7 @@ class Integrations::Slack::SendOnSlackService < Base::SendOnChannelService post_message if message_content.present? upload_file if message.attachments.any? rescue Slack::Web::Api::Errors::AccountInactive => e - Rails.logger.info e + Rails.logger.error e hook.authorization_error! hook.disable if hook.enabled? end diff --git a/spec/cypress/app_commands/log_fail.rb b/spec/cypress/app_commands/log_fail.rb index 8c64be394..264d9ea66 100644 --- a/spec/cypress/app_commands/log_fail.rb +++ b/spec/cypress/app_commands/log_fail.rb @@ -13,7 +13,7 @@ if defined?(ActiveRecord::Base) ActiveRecord::Base.descendants.each_with_object({}) do |record_class, records| records[record_class.to_s] = record_class.limit(100).map(&:attributes) rescue StandardError => e - Rails.logger.info e.message + Rails.logger.error e.message end end