Skip to content

Commit

Permalink
Print authentication error stack-trace in INFO level
Browse files Browse the repository at this point in the history
We would like to enhance our supportability by printing a
minimal stack trace that can help the reader understand the issue,
without adding clutter to the log.
  • Loading branch information
orenbm committed Mar 24, 2021
1 parent d8234d4 commit ce3d0b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[cyberark/conjur#2052](https://github.com/cyberark/conjur/issues/2052)
- When a user checks permissions of a non-existing role or a non-existing resource, Conjur now audits a failure message.
[cyberark/conjur#2059](https://github.com/cyberark/conjur/issues/2059)
- Print login and authentication error stack trace to the log in INFO level.
[cyberark/conjur#2080](https://github.com/cyberark/conjur/issues/2080)

### Changed
- The secrets batch retrieval endpoint now refers to the `Accept-Encoding` header rather than `Accept` to determine the response encoding
Expand Down
7 changes: 6 additions & 1 deletion app/controllers/authenticate_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,12 @@ def handle_authentication_error(err)

def log_backtrace(err)
err.backtrace.each do |line|
logger.debug(line)
# We want to print a minimal stack trace in INFO level so that it is easier
# to understand the issue. To do this, we filter the trace output to only
# Conjur application code, and not code from the Gem dependencies.
# We still want to print the full stack trace (including the Gem dependencies
# code) so we print it in DEBUG level.
line.include?(ENV['GEM_HOME']) ? logger.debug(line) : logger.info(line)
end
end

Expand Down

0 comments on commit ce3d0b2

Please sign in to comment.