Skip to content

Commit 1f595b4

Browse files
JohnTitormark-i-m
authored andcommitted
Rename to RUSTC_LOG
1 parent 669b885 commit 1f595b4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/compiler-debugging.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ $ # Cool, now I have a backtrace for the error
149149
These crates are used in compiler for logging:
150150
151151
* [log]
152-
* [env-logger]: check the link to see the full `RUST_LOG` syntax
152+
* [env-logger]: check the link to see the full `RUSTC_LOG` syntax
153153
154154
[log]: https://docs.rs/log/0.4.6/log/index.html
155155
[env-logger]: https://docs.rs/env_logger/0.4.3/env_logger/
@@ -159,9 +159,9 @@ at many points. These are very useful to at least narrow down the location of
159159
a bug if not to find it entirely, or just to orient yourself as to why the
160160
compiler is doing a particular thing.
161161
162-
To see the logs, you need to set the `RUST_LOG` environment variable to
162+
To see the logs, you need to set the `RUSTC_LOG` environment variable to
163163
your log filter, e.g. to get the logs for a specific module, you can run the
164-
compiler as `RUST_LOG=module::path rustc my-file.rs`. All `debug!` output will
164+
compiler as `RUSTC_LOG=module::path rustc my-file.rs`. All `debug!` output will
165165
then appear in standard error.
166166
167167
**Note that unless you use a very strict filter, the logger will emit a lot of
@@ -174,16 +174,16 @@ So to put it together.
174174
```bash
175175
# This puts the output of all debug calls in `librustc/traits` into
176176
# standard error, which might fill your console backscroll.
177-
$ RUST_LOG=rustc::traits rustc +local my-file.rs
177+
$ RUSTC_LOG=rustc::traits rustc +local my-file.rs
178178
179179
# This puts the output of all debug calls in `librustc/traits` in
180180
# `traits-log`, so you can then see it with a text editor.
181-
$ RUST_LOG=rustc::traits rustc +local my-file.rs 2>traits-log
181+
$ RUSTC_LOG=rustc::traits rustc +local my-file.rs 2>traits-log
182182
183183
# Not recommended. This will show the output of all `debug!` calls
184184
# in the Rust compiler, and there are a *lot* of them, so it will be
185185
# hard to find anything.
186-
$ RUST_LOG=debug rustc +local my-file.rs 2>all-log
186+
$ RUSTC_LOG=debug rustc +local my-file.rs 2>all-log
187187
188188
# This will show the output of all `info!` calls in `rustc_trans`.
189189
#
@@ -192,7 +192,7 @@ $ RUST_LOG=debug rustc +local my-file.rs 2>all-log
192192
# which function triggers an LLVM assertion, and this is an `info!`
193193
# log rather than a `debug!` log so it will work on the official
194194
# compilers.
195-
$ RUST_LOG=rustc_trans=info rustc +local my-file.rs
195+
$ RUSTC_LOG=rustc_trans=info rustc +local my-file.rs
196196
```
197197
198198
### How to keep or remove `debug!` and `trace!` calls from the resulting binary
@@ -201,7 +201,7 @@ While calls to `error!`, `warn!` and `info!` are included in every build of the
201201
calls to `debug!` and `trace!` are only included in the program if
202202
`debug-assertions=yes` is turned on in config.toml (it is
203203
turned off by default), so if you don't see `DEBUG` logs, especially
204-
if you run the compiler with `RUST_LOG=rustc rustc some.rs` and only see
204+
if you run the compiler with `RUSTC_LOG=rustc rustc some.rs` and only see
205205
`INFO` logs, make sure that `debug-assertions=yes` is turned on in your
206206
config.toml.
207207
@@ -230,7 +230,7 @@ If in the module `rustc::foo` you have a statement
230230
debug!("{:?}", random_operation(tcx));
231231
```
232232
233-
Then if someone runs a debug `rustc` with `RUST_LOG=rustc::bar`, then
233+
Then if someone runs a debug `rustc` with `RUSTC_LOG=rustc::bar`, then
234234
`random_operation()` will run.
235235
236236
This means that you should not put anything too expensive or likely to crash

0 commit comments

Comments
 (0)