From 8b9d9669bb7e3e3f3806a16ea5b7440804356e40 Mon Sep 17 00:00:00 2001 From: Morten Hustveit Date: Thu, 10 Nov 2016 15:39:52 -0500 Subject: [PATCH] Have ConsoleLogger log to stderr instead of stdout (#1714) On Unix systems, it's common for programs to read their input from stdin, and write their output to stdout. Messages should be written to stderr, where they won't corrupt a program's output, and where they can be seen by the user even if the output is being redirected. This is mostly a problem when XGBoost is being used from Python or from another program. --- src/logging.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logging.cc b/src/logging.cc index f579f9a97..934bb0414 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -12,7 +12,7 @@ namespace xgboost { #if XGBOOST_CUSTOMIZE_LOGGER == 0 ConsoleLogger::~ConsoleLogger() { - std::cout << log_stream_.str() << std::endl; + std::cerr << log_stream_.str() << std::endl; } TrackerLogger::~TrackerLogger() {