-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add log-backtrace option to show backtraces along with logging #104645
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @oli-obk (or someone else) soon. Please see the contribution instructions for more information. |
68323b1
to
64dd4b3
Compare
This comment has been minimized.
This comment has been minimized.
64dd4b3
to
0fc4fb6
Compare
☔ The latest upstream changes (presumably #105271) made this pull request unmergeable. Please resolve the merge conflicts. |
I apologize, I misunderstood what was going on here, this is a very different PR from the other one. This lgtm. Just needs a rebase, then we can land it. @rustbot author |
0fc4fb6
to
5135eac
Compare
compiler/rustc_driver/src/lib.rs
Outdated
init_rustc_env_logger_with_backtrace_option(&config.opts.unstable_opts.log_backtrace); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we'll stop getting logs before parsing command line flags, but that seems ok to me. The only alternative I see would be to use an env var instead of a command line flag, but I'm not sure if that matters much, so let's land it, we can always adjust it later if someone has a stronger opinion about it
@bors r+ rollup |
…oli-obk Add log-backtrace option to show backtraces along with logging according to rust-lang#90698, I added a compiler option, `-Zlog-backtrace=filter`, where `filter` is a module name, to show backtraces for logging without rebuilding. resolve rust-lang#90698
I think this PR broke PR CI in the rollup #106725 (https://github.com/rust-lang/rust/actions/runs/3894414159/jobs/6648375548#step:26:80428), even though it passed CI here Can you rebase and see whether it breaks here as well after it? |
hmm, I think I already rebased this branch onto b22c152 (current master). |
Weird, creating a new rollup (#106730) with the same PRs except this one made it pass (and the original panic was in rustc_log), so it's highly likely that something doesn't like this PR. Maybe there's some weird conflict between the PRs in there and this one, I suggest you try rebasing again when the rollup is merged. |
It looks like the PR CI passed here because it got skipped. |
Ah this seems to break tools. You can run clippy and miri tests directly via |
Aww I'm sorry this happens over and over! |
6c986b7
to
4e2a356
Compare
The problem was that the logger initialization gets called more than once in some tests. I fixed it so the logger initialization process wouldn't be called more than once. I tested with clappy and miri. |
@rustbot label -S-waiting-on-author +S-waiting-on-review |
@bors r+ |
…oli-obk Add log-backtrace option to show backtraces along with logging according to rust-lang#90698, I added a compiler option, `-Zlog-backtrace=filter`, where `filter` is a module name, to show backtraces for logging without rebuilding. resolve rust-lang#90698
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#104645 (Add log-backtrace option to show backtraces along with logging) - rust-lang#106465 (Bump `IMPLIED_BOUNDS_ENTAILMENT` to Deny + ReportNow) - rust-lang#106489 (Fix linker detection for linker (drivers) with a version postfix (e.g. clang-12 instead of clang)) - rust-lang#106585 (When suggesting writing a fully qualified path probe for appropriate types) - rust-lang#106641 (Provide help on closures capturing self causing borrow checker errors) - rust-lang#106678 (Warn when using panic-strategy abort for proc-macro crates) - rust-lang#106701 (Fix `mpsc::SyncSender` spinning behavior) - rust-lang#106793 (Normalize test output more thoroughly) - rust-lang#106797 (riscv: Fix ELF header flags) - rust-lang#106813 (Remove redundant session field) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
@@ -231,6 +231,10 @@ fn run_compiler( | |||
registry: diagnostics_registry(), | |||
}; | |||
|
|||
if !tracing::dispatcher::has_been_set() { | |||
init_rustc_env_logger_with_backtrace_option(&config.opts.unstable_opts.log_backtrace); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is somewhat unfortunate for Miri, which was relying on run_compiler
not initializing the logger... see rust-lang/miri#2778. (That was a hack, but with the fact that logger filters cannot be changed at runtime, it's hard to avoid such hacks.)
Replace a command line flag with an env var to allow tools to initialize the tracing loggers at their own discretion fixes rust-lang/miri#2778 this was introduced in rust-lang#104645, so this PR reverts the flag-part and uses an env var instead.
Replace a command line flag with an env var to allow tools to initialize the tracing loggers at their own discretion fixes rust-lang/miri#2778 this was introduced in rust-lang#104645, so this PR reverts the flag-part and uses an env var instead.
Replace a command line flag with an env var to allow tools to initialize the tracing loggers at their own discretion fixes rust-lang/miri#2778 this was introduced in rust-lang#104645, so this PR reverts the flag-part and uses an env var instead.
Replace a command line flag with an env var to allow tools to initialize the tracing loggers at their own discretion fixes rust-lang#2778 this was introduced in rust-lang/rust#104645, so this PR reverts the flag-part and uses an env var instead.
Upgrade our toolchain to `nightly-2023-01-23`. The changes here are related to the following changes: - rust-lang/rust#104986 - rust-lang/rust#105657 - rust-lang/rust#105603 - rust-lang/rust#105613 - rust-lang/rust#105977 - rust-lang/rust#104645
according to #90698, I added a compiler option,
-Zlog-backtrace=filter
, wherefilter
is a module name, to show backtraces for logging without rebuilding.resolve #90698