Commit 35552b4f authored by Stan Hu's avatar Stan Hu

Merge branch 'log-more-lines-for-exceptions' into 'master'

Log more lines for exceptions

See merge request gitlab-org/gitlab!39623
parents 65727814 e3a3bb21
# frozen_string_literal: true
# Remove some GitLab code from backtraces. Do not use this for logging errors in
# production environments, as the error may be thrown by our middleware.
module Gitlab
module BacktraceCleaner
IGNORE_BACKTRACES = %w[
......
......@@ -23,7 +23,7 @@ module Gitlab
end
if exception.backtrace
payload['exception.backtrace'] = Gitlab::BacktraceCleaner.clean_backtrace(exception.backtrace)
payload['exception.backtrace'] = Rails.backtrace_cleaner.clean(exception.backtrace)
end
end
end
......
......@@ -18,7 +18,7 @@ module Gitlab
data.merge!(job_data) if job_data.present?
end
data[:error_backtrace] = Gitlab::BacktraceCleaner.clean_backtrace(job_exception.backtrace) if job_exception.backtrace.present?
data[:error_backtrace] = Rails.backtrace_cleaner.clean(job_exception.backtrace) if job_exception.backtrace.present?
Sidekiq.logger.warn(data)
end
......
......@@ -98,7 +98,7 @@ RSpec.describe Gitlab::GrapeLogging::Loggers::ExceptionLogger do
before do
current_backtrace = caller
allow(exception).to receive(:backtrace).and_return(current_backtrace)
expected['exception.backtrace'] = Gitlab::BacktraceCleaner.clean_backtrace(current_backtrace)
expected['exception.backtrace'] = Rails.backtrace_cleaner.clean(current_backtrace)
end
it 'includes the backtrace' do
......
......@@ -33,7 +33,7 @@ RSpec.describe Gitlab::SidekiqLogging::ExceptionHandler do
error_class: 'RuntimeError',
error_message: exception_message,
context: 'Test',
error_backtrace: Gitlab::BacktraceCleaner.clean_backtrace(backtrace)
error_backtrace: Rails.backtrace_cleaner.clean(backtrace)
)
expect(logger).to receive(:warn).with(expected_data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment