diff --git a/examples/cpp/binpacking_2d_sat.cc b/examples/cpp/binpacking_2d_sat.cc index a3ccfea2cf..51df755c27 100644 --- a/examples/cpp/binpacking_2d_sat.cc +++ b/examples/cpp/binpacking_2d_sat.cc @@ -221,7 +221,7 @@ void LoadAndSolve(const std::string& file_name, int instance) { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); if (absl::GetFlag(FLAGS_input).empty()) { LOG(FATAL) << "Please supply a data file with --input="; diff --git a/examples/cpp/constraint_programming_cp.cc b/examples/cpp/constraint_programming_cp.cc index 78cdee5c95..ca1f35c275 100644 --- a/examples/cpp/constraint_programming_cp.cc +++ b/examples/cpp/constraint_programming_cp.cc @@ -56,7 +56,7 @@ void RunConstraintProgrammingExample() { int main(int argc, char** argv) { google::InitGoogleLogging(argv[0]); - absl::SetFlag(&FLAGS_logtostderr, 1); + absl::SetFlag(&FLAGS_stderrthreshold, 0); operations_research::RunConstraintProgrammingExample(); return EXIT_SUCCESS; } diff --git a/examples/cpp/costas_array_sat.cc b/examples/cpp/costas_array_sat.cc index cefcf202e1..e27d15e957 100644 --- a/examples/cpp/costas_array_sat.cc +++ b/examples/cpp/costas_array_sat.cc @@ -297,7 +297,7 @@ void CostasBoolSoft(const int dim) { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); int min = 1; diff --git a/examples/cpp/golomb_sat.cc b/examples/cpp/golomb_sat.cc index d966b7f10c..51192639e3 100644 --- a/examples/cpp/golomb_sat.cc +++ b/examples/cpp/golomb_sat.cc @@ -120,7 +120,7 @@ void GolombRuler(int size) { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); if (absl::GetFlag(FLAGS_size) != 0) { diff --git a/examples/cpp/jobshop_sat.cc b/examples/cpp/jobshop_sat.cc index 0f8cc9485a..ab5611c4af 100644 --- a/examples/cpp/jobshop_sat.cc +++ b/examples/cpp/jobshop_sat.cc @@ -849,7 +849,7 @@ void Solve(const JsspInputProblem& problem) { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); if (absl::GetFlag(FLAGS_input).empty()) { diff --git a/examples/cpp/knapsack_2d_sat.cc b/examples/cpp/knapsack_2d_sat.cc index 311d3ccd90..6764a90d45 100644 --- a/examples/cpp/knapsack_2d_sat.cc +++ b/examples/cpp/knapsack_2d_sat.cc @@ -225,7 +225,7 @@ void LoadAndSolve(const std::string& file_name, int instance) { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); if (absl::GetFlag(FLAGS_input).empty()) { LOG(FATAL) << "Please supply a data file with --input="; diff --git a/examples/cpp/magic_sequence_sat.cc b/examples/cpp/magic_sequence_sat.cc index 3c086f1b5a..c32d63c87d 100644 --- a/examples/cpp/magic_sequence_sat.cc +++ b/examples/cpp/magic_sequence_sat.cc @@ -92,7 +92,7 @@ void MagicSequence(int size) { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); operations_research::sat::MagicSequence(absl::GetFlag(FLAGS_size)); diff --git a/examples/cpp/magic_square_sat.cc b/examples/cpp/magic_square_sat.cc index 8438bff069..c1ee26e1c2 100644 --- a/examples/cpp/magic_square_sat.cc +++ b/examples/cpp/magic_square_sat.cc @@ -101,7 +101,7 @@ void MagicSquare(int size) { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); operations_research::sat::MagicSquare(absl::GetFlag(FLAGS_size)); diff --git a/examples/cpp/max_flow.cc b/examples/cpp/max_flow.cc index a7f3913024..d6f225e88a 100644 --- a/examples/cpp/max_flow.cc +++ b/examples/cpp/max_flow.cc @@ -54,7 +54,7 @@ void SolveMaxFlow() { int main(int argc, char** argv) { google::InitGoogleLogging(argv[0]); - absl::SetFlag(&FLAGS_logtostderr, 1); + absl::SetFlag(&FLAGS_stderrthreshold, 0); operations_research::SolveMaxFlow(); return EXIT_SUCCESS; } diff --git a/examples/cpp/min_cost_flow.cc b/examples/cpp/min_cost_flow.cc index fe5ea1a05b..2600188f36 100644 --- a/examples/cpp/min_cost_flow.cc +++ b/examples/cpp/min_cost_flow.cc @@ -70,7 +70,7 @@ void SolveMinCostFlow() { int main(int argc, char** argv) { google::InitGoogleLogging(argv[0]); - absl::SetFlag(&FLAGS_logtostderr, 1); + absl::SetFlag(&FLAGS_stderrthreshold, 0); operations_research::SolveMinCostFlow(); return EXIT_SUCCESS; } diff --git a/examples/cpp/mps_driver.cc b/examples/cpp/mps_driver.cc index 9d276479df..a262ce8e92 100644 --- a/examples/cpp/mps_driver.cc +++ b/examples/cpp/mps_driver.cc @@ -90,7 +90,7 @@ int main(int argc, char* argv[]) { "The files must be in Mps or linear_solver.proto format and can be " "compressed with gzip.", &argc, &argv, true); - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); GlopParameters parameters; ReadGlopParameters(¶meters); diff --git a/examples/cpp/multi_knapsack_sat.cc b/examples/cpp/multi_knapsack_sat.cc index 3484229c79..9d6aa7c625 100644 --- a/examples/cpp/multi_knapsack_sat.cc +++ b/examples/cpp/multi_knapsack_sat.cc @@ -109,7 +109,7 @@ void MultiKnapsackSat(int scaling, const std::string& params) { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); operations_research::sat::MultiKnapsackSat(absl::GetFlag(FLAGS_size), absl::GetFlag(FLAGS_params)); diff --git a/examples/cpp/network_routing_sat.cc b/examples/cpp/network_routing_sat.cc index a9eb2a3051..c462c70eb0 100644 --- a/examples/cpp/network_routing_sat.cc +++ b/examples/cpp/network_routing_sat.cc @@ -678,7 +678,7 @@ class NetworkRoutingSolver { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); operations_research::sat::NetworkRoutingData data; diff --git a/examples/cpp/pdlp_solve.cc b/examples/cpp/pdlp_solve.cc index 66ffd861da..85024fd0ff 100644 --- a/examples/cpp/pdlp_solve.cc +++ b/examples/cpp/pdlp_solve.cc @@ -124,7 +124,7 @@ void Solve(const std::string& input, const std::string& params_str, } // namespace operations_research::pdlp int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); google::InitGoogleLogging(kUsageStr); absl::ParseCommandLine(argc, argv); diff --git a/examples/cpp/pdptw.cc b/examples/cpp/pdptw.cc index 8e9c4b0ff0..752c178a6e 100644 --- a/examples/cpp/pdptw.cc +++ b/examples/cpp/pdptw.cc @@ -397,7 +397,7 @@ bool LoadAndSolve(const std::string& pdp_file, } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); operations_research::RoutingModelParameters model_parameters = operations_research::DefaultRoutingModelParameters(); diff --git a/examples/cpp/shift_minimization_sat.cc b/examples/cpp/shift_minimization_sat.cc index 4fcfe93643..c06754b25e 100644 --- a/examples/cpp/shift_minimization_sat.cc +++ b/examples/cpp/shift_minimization_sat.cc @@ -304,7 +304,7 @@ void LoadAndSolve(const std::string& file_name) { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); if (absl::GetFlag(FLAGS_input).empty()) { diff --git a/examples/cpp/sports_scheduling_sat.cc b/examples/cpp/sports_scheduling_sat.cc index 9a27225666..2806618b20 100644 --- a/examples/cpp/sports_scheduling_sat.cc +++ b/examples/cpp/sports_scheduling_sat.cc @@ -327,7 +327,7 @@ static const char kUsage[] = "There is no output besides the LOGs of the solver."; int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(kUsage, &argc, &argv, true); CHECK_EQ(0, absl::GetFlag(FLAGS_num_teams) % 2) << "The number of teams must be even"; diff --git a/examples/cpp/uncapacitated_facility_location.cc b/examples/cpp/uncapacitated_facility_location.cc index f0308713ec..5cae1d0130 100644 --- a/examples/cpp/uncapacitated_facility_location.cc +++ b/examples/cpp/uncapacitated_facility_location.cc @@ -237,7 +237,7 @@ int main(int argc, char** argv) { << "Specify a non-null client size."; CHECK_LT(0, absl::GetFlag(FLAGS_fix_cost)) << "Specify a non-null client size."; - absl::SetFlag(&FLAGS_logtostderr, 1); + absl::SetFlag(&FLAGS_stderrthreshold, 0); operations_research::RunAllExamples(absl::GetFlag(FLAGS_facilities), absl::GetFlag(FLAGS_clients), absl::GetFlag(FLAGS_fix_cost)); diff --git a/examples/cpp/vector_bin_packing_solver.cc b/examples/cpp/vector_bin_packing_solver.cc index 60f46e3435..f2c864e9b5 100644 --- a/examples/cpp/vector_bin_packing_solver.cc +++ b/examples/cpp/vector_bin_packing_solver.cc @@ -98,7 +98,7 @@ void ParseAndSolve(const std::string& filename, absl::string_view solver, } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); if (absl::GetFlag(FLAGS_input).empty()) { LOG(FATAL) << "Please supply a data file with --input="; diff --git a/examples/cpp/weighted_tardiness_sat.cc b/examples/cpp/weighted_tardiness_sat.cc index 8bde2fc951..2332031c6f 100644 --- a/examples/cpp/weighted_tardiness_sat.cc +++ b/examples/cpp/weighted_tardiness_sat.cc @@ -252,7 +252,7 @@ void ParseAndSolve() { } // namespace operations_research int main(int argc, char** argv) { - absl::SetFlag(&FLAGS_logtostderr, true); + absl::SetFlag(&FLAGS_stderrthreshold, 0); InitGoogle(argv[0], &argc, &argv, true); if (absl::GetFlag(FLAGS_input).empty()) { LOG(FATAL) << "Please supply a data file with --input="; diff --git a/examples/python/integer_programming.py b/examples/python/integer_programming.py index c127031a2e..c3c010f9a0 100644 --- a/examples/python/integer_programming.py +++ b/examples/python/integer_programming.py @@ -119,7 +119,7 @@ def main(): if __name__ == '__main__': pywrapinit.CppBridge.InitLogging('integer_programming.py') cpp_flags = pywrapinit.CppFlags() - cpp_flags.logtostderr = True + cpp_flags.stderrthreshold = 0 cpp_flags.log_prefix = False pywrapinit.CppBridge.SetFlags(cpp_flags) main() diff --git a/examples/tests/lp_test.cc b/examples/tests/lp_test.cc index 640f5eaa9d..ba0097ccb6 100644 --- a/examples/tests/lp_test.cc +++ b/examples/tests/lp_test.cc @@ -226,7 +226,7 @@ void RunAllExamples() { int main(int argc, char** argv) { google::InitGoogleLogging(argv[0]); - absl::SetFlag(&FLAGS_logtostderr, 1); + absl::SetFlag(&FLAGS_stderrthreshold, 0); operations_research::RunAllExamples(); return 0; } diff --git a/ortools/base/logging.h b/ortools/base/logging.h index 028a3bc1ec..7f570f969e 100644 --- a/ortools/base/logging.h +++ b/ortools/base/logging.h @@ -33,6 +33,9 @@ // Compatibility layer for glog/previous logging code. ABSL_DECLARE_FLAG(bool, logtostderr); +// Forward the new flag. +ABSL_DECLARE_FLAG(int, stderrthreshold); + namespace operations_research { void FixFlagsAndEnvironmentForSwig();