Skip to content

Commit b99f641

Browse files
andreas-abelcopybara-github
authored andcommitted
Write LOG(WARNING) to stderr by default
PiperOrigin-RevId: 737663723 Change-Id: Ifdfb843bc4d3770fe201561587d2936a8bb10684
1 parent 033213d commit b99f641

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

fleetbench/BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@ cc_library(
109109
":dynamic_registrar",
110110
":maybe_llvmlibc",
111111
"//fleetbench/common",
112+
"@com_google_absl//absl/base:log_severity",
112113
"@com_google_absl//absl/flags:parse",
113114
"@com_google_absl//absl/log",
114115
"@com_google_absl//absl/log:check",
116+
"@com_google_absl//absl/log:globals",
117+
"@com_google_absl//absl/log:initialize",
115118
"@com_google_benchmark//:benchmark",
116119
"@com_google_tcmalloc//tcmalloc:malloc_extension",
117120
"@libnuma//:numa",

fleetbench/benchmark_main.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
#include <thread>
2020
#include <vector>
2121

22+
#include "absl/base/log_severity.h"
2223
#include "absl/flags/flag.h"
2324
#include "absl/flags/parse.h"
2425
#include "absl/log/check.h"
26+
#include "absl/log/globals.h"
27+
#include "absl/log/initialize.h"
2528
#include "absl/log/log.h"
2629
#include "benchmark/benchmark.h"
2730
#include "fleetbench/common/common.h"
@@ -38,12 +41,16 @@ ABSL_FLAG(bool, prevent_numa_migrations, true,
3841
int main(int argc, char* argv[]) {
3942
benchmark::Initialize(&argc, argv);
4043
absl::ParseCommandLine(argc, argv);
44+
absl::InitializeLog();
4145
static auto* background ABSL_ATTRIBUTE_UNUSED =
4246
tcmalloc::MallocExtension::NeedsProcessBackgroundActions() ?
4347
new std::thread([]() {
4448
tcmalloc::MallocExtension::ProcessBackgroundActions();
4549
}) : nullptr;
4650

51+
// Print warnings to stderr.
52+
absl::SetStderrThreshold(absl::LogSeverityAtLeast::kWarning);
53+
4754
if (absl::GetFlag(FLAGS_prevent_numa_migrations) && numa_available() != -1) {
4855
// Set the CPU affinity to the intersection of the current affinity and the
4956
// CPUs in the current NUMA node.

0 commit comments

Comments
 (0)