bazelbuild / bazelbuild/bazel

Warnings from actions are printed at INFO level

Open
#22,973 3 comments 0 reactions 0 assignees View on GitHub
P3 stale team-CLI type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

Actions run by `ctx.run_shell` that print warnings (to stderr) are reported at the `INFO` level in https://github.com/bazelbuild/bazel/blob/d5e62f102b57c458c080a38f4d17852efc3b98a2/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java#L1755

This makes it impossible to separate warnings from tools from Bazel's own `INFO` level noise during a build:
```
INFO: Analyzed target (37 packages loaded, 1787 targets configured).
INFO: From for :

INFO: Found 1 target...
Target up-to-date:

INFO: Elapsed time: 5.174s, Critical Path: 4.00s
INFO: 4 processes: 2 internal, 2 linux-sandbox.
INFO: Build completed successfully, 4 total actions
```

I think that the correct action here is to either use `EventKind.STDOUT` and `EventKind.STDERR` , which appear to be their intended use so that `--ui_event_filter=-info,+stderr` will work to achieve the same:
https://github.com/bazelbuild/bazel/blob/d5e62f102b57c458c080a38f4d17852efc3b98a2/src/main/java/com/google/devtools/build/lib/events/EventKind.java#L70-L74

Or that `dumpRecordedOutErr()` should use `WARN` for `stderr` and `INFO` for `stdout`.

### Which category does this issue belong to?

CLI

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

_No response_

### Which operating system are you running Bazel on?

_No response_

### What is the output of `bazel info release`?

_No response_

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

_No response_

### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java at the referenced dumpRecordedOutErr call, then read the relevant EventKind definitions in src/main/java/com/google/devtools/build/lib/events/EventKind.java. Reproduce an action run by ctx.run_shell that writes warnings to stderr and verify that stderr is no longer reported at INFO level and can be selected with the UI event filter.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.