bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.13k stars 4.05k forks source link

--ui_event_filters=-INFO does not suppress the last INFO message in the output #12117

Open konste opened 4 years ago

konste commented 4 years ago

Description of the problem / feature request:

Bazel 3.6.0 is going to remove --experimental_ui_limit_console_output in favor of --ui_event_filters. Unfortunately --ui_event_filters implementation has a small, but annoying bug: when --ui_event_filters=-INFO is specified it skips all INFO messages from the output except the last one!

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

Run any build with --ui_event_filters=-INFO. You still going to see INFO: Build completed successfully, 1 total action at the end of the console output.

What operating system are you running Bazel on?

Linux, Windows

What's the output of bazel info release?

3.5.0

Yannic commented 4 years ago

I ran into this today as well (Bazel 3.4.1 & HEAD). The message is written to the terminal here: https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/runtime/UiStateTracker.java;l=1084;drc=e3285b8b4593a0672284e577de79d368a50d8596

gregestren commented 4 years ago

Assigned based on https://github.com/bazelbuild/bazel/commit/5bb3becc09ef535276576a31d98d8686b248bbea.

michajlo commented 4 years ago

This predates my cleanup. To suppress it you can set --noshow_progress.

konste commented 4 years ago

Thank you @michajlo for the tip about --noshow_progress. It is better than no workaround at all but worse than the actual fix. We definitely want to keep seeing the progress, just to know that it is actually working when it takes too long. We want to see errors as well to know if something went wrong. But that last INFO message (as well as all other INFO messages) we don't want to be produced as the Bazel is driven by another tool which produces more meaningful for the purpose messages when everything is successful.

michajlo commented 4 years ago

Internally it's not actually an INFO event but part of the progress reporting (https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/runtime/UiStateTracker.java;l=419;drc=cb1f9f6038f361a22b501e958bb0710985e561c5;bpv=0;bpt=1). That it's using INFO as the status string is an unfortunate coincidence. Making it something like SUCCESS could be a good compromise, but it will require some due diligence to make sure it's not too load bearing... Fortunately it seems like this is the only "status" that overlaps with event kinds.

konste commented 4 years ago

As far as I can see here there are event kinds START and FINISH. Can this naughty event be recategorized as the one of a FINISH kind? That is if it cannot be recategorized as the INFO, of course. Logically it should not belong to the progress reporting group.

michael-lefkowitz-techlabs commented 3 years ago

Still would like to see this one fixed. I've written a script to try to discover unused Bazel deps, and it involves running bazel test and bazel build quite a few times. I'd like to see any ERROR logs, and progress, but not any of the other logging.

meisterT commented 2 years ago

I looked into #16085 yesterday and agree with https://github.com/bazelbuild/bazel/issues/12117#issuecomment-695113868 - the issue is that we use progress reporting for this. I think the proper way to fix this bug is to not make it a progress bar update.