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

Add a way to give backtraces for logging #90698

Closed
jyn514 opened this issue Nov 8, 2021 · 8 comments · Fixed by #104645
Closed

Add a way to give backtraces for logging #90698

jyn514 opened this issue Nov 8, 2021 · 8 comments · Fixed by #104645
Assignees
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@jyn514
Copy link
Member

jyn514 commented Nov 8, 2021

I ran into the following problem today: I had a prebuilt (with download-rustc) compiler and wanted to get a backtrace for some info! logging it was outputting, to see how it got to that point. But there's no way to get a backtrace there without rebuilding the compiler from source. It would be really cool if there were a way to have backtraces for each individual logging call. To avoid making the compiler horrifically slow, it could be behind a -Zlog-backtrace=filter flag.

This would be useful even if you have a local build of the compiler, since you don't have to rebuild it each time you want to get a stack trace.

@davidbarsky suggests doing this by adding a custom Layer which filters based on a string. Debugging options are handled around

DebuggingOptions, DB_OPTIONS, "Z", "debugging",

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself labels Nov 8, 2021
@wihobbs
Copy link

wihobbs commented Nov 9, 2021

@rustbot claim

@AkechiShiro
Copy link

Hi @wihobbs, I'm interested in working on this issue, are you still working on it ? If not could I take it from now and try to actually solve it someway or another ?

@wihobbs
Copy link

wihobbs commented Feb 16, 2022

Hi @AkechiShiro, yes, I'm still working on it. Been bogged down with a few other things lately but if you'd like I'm happy to collaborate!

@AkechiShiro
Copy link

Hi @wihobbs, sure I'm fine in collaborating for this issue, is there any way to know what is WIP at the moment? And how I could get started on this issue ? What do you suggest I look at first or play around with ?

Did you understand how you could use the Layer object mentioned in the first message?

@yukiomoto
Copy link
Contributor

@rustbot claim

@yukiomoto
Copy link
Contributor

Hi @jyn514

But there's no way to get a backtrace there without rebuilding the compiler from source.

I understand that this issue is about getting backtraces for logging without rebuilding the compiler but may I ask if you mean there is already a way to get a backtrace for each info! loggings ? This might not be directly related but I'm just curious.

I'm sorry if this is a newbie question..!

@jyn514
Copy link
Member Author

jyn514 commented Nov 14, 2022

I ask if you mean there is already a way to get a backtrace for each info! loggings ? This might not be directly related but I'm just curious.

Yes, you can turn the info log you're interested in into a panic :P but obviously that requires rebuilding and it will break half the test suite to boot.

@yukiomoto
Copy link
Contributor

@jyn514
I now understand what you mean. Thank you!

Noratrieb added a commit to Noratrieb/rust that referenced this issue Jan 11, 2023
…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
Noratrieb added a commit to Noratrieb/rust that referenced this issue Jan 12, 2023
…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
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 13, 2023
…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
@bors bors closed this as completed in 96bb02f Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants