Skip to content

Fix --log-levels-by-target not working for logs from Python code (Cherry-pick of #13939))#13941

Merged
Eric-Arellano merged 1 commit intopantsbuild:2.8.xfrom
Eric-Arellano:cp-logs-28
Dec 21, 2021
Merged

Fix --log-levels-by-target not working for logs from Python code (Cherry-pick of #13939))#13941
Eric-Arellano merged 1 commit intopantsbuild:2.8.xfrom
Eric-Arellano:cp-logs-28

Conversation

@Eric-Arellano
Copy link
Contributor

Fixes #13938.

The problem is as I suspected in the issue. The logging level was being set globally in Pythonland, and if the log-call level was < the global level, we never entered Rustland to consider log_levels_by_target.


Using ./pants_from_sources --stats-log ... on my repo I see:

level = "warn"
log_levels_by_target = {"pants.goal.stats_aggregator" = "info"}

DOES print the stats (INFO). Previously it would not.

and additionally (to test inversion)

level = "debug"
log_levels_by_target = {"pants.goal.stats_aggregator" = "warn"}

DOES NOT print the stats (INFO)

Rust tests and lints will be skipped. Delete if not intended.

[ci skip-rust]

Building wheels and fs_util will be skipped. Delete if not intended.

[ci skip-build-wheels]

…antsbuild#13939)

Fixes pantsbuild#13938.

The problem is as I suspected in the issue. The logging level was being set globally in Pythonland, and if the log-call level was < the global level, we never entered Rustland to consider `log_levels_by_target`.

---

Using `./pants_from_sources --stats-log ...` on my repo I see:
```
level = "warn"
log_levels_by_target = {"pants.goal.stats_aggregator" = "info"}
```
DOES print the stats (`INFO`). Previously it would not.

and additionally (to test inversion)
```
level = "debug"
log_levels_by_target = {"pants.goal.stats_aggregator" = "warn"}
```
DOES NOT print the stats (`INFO`)

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@Eric-Arellano Eric-Arellano merged commit 8cd274e into pantsbuild:2.8.x Dec 21, 2021
@Eric-Arellano Eric-Arellano deleted the cp-logs-28 branch December 21, 2021 20:29
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.

2 participants