Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make backtrace logging configurable: pretty-printed or logged #1674

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

jbearer
Copy link
Member

@jbearer jbearer commented Jul 3, 2024

Adds an option to log panics via the tracing formatter, so they can be parsed and interpeted by Datadog. If RUST_LOG_FORMAT=json is not set, panics will be pretty-printed directly to standard out, as they have been until now.

This PR:

  • Makes logging configurable via env var/CLI
  • Chooses which panic handler to install based on RUST_LOG_FORMAT

Key places to review:

  • utils/src/logging.rs has the logging setup code and config parameters
  • deleted utility program count-transactions as the query service now has this functionality
  • all other changes are just replacing
    setup_logging();
    setup_backtrace();
    with either logging::Config::init (for main binaries, to get the config from the command line) or setup_test

Things tested

  • demo-native works
  • manually forcing a panic gives correct output based on the env
  • git grep setup_logging and git grep setup_backtrace have no results outside the logging utils

@Ancient123
Copy link
Member

I think it would be cleaner to just use the value in RUST_LOG_FORMAT which we have to set to json in order to enable json logging output right now anyways.

@jbearer
Copy link
Member Author

jbearer commented Jul 3, 2024

Done in 2982c72

Copy link
Contributor

@imabdulbasit imabdulbasit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jbearer jbearer merged commit 4caf205 into main Jul 30, 2024
15 checks passed
@jbearer jbearer deleted the jb/log-panics branch July 30, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants