From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C5571A054A
	for <public@inbox.dpdk.org>; Tue,  9 Feb 2021 16:06:29 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id B6A991606F1;
	Tue,  9 Feb 2021 16:06:29 +0100 (CET)
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by mails.dpdk.org (Postfix) with ESMTP id 4E49E40147;
 Tue,  9 Feb 2021 16:06:25 +0100 (CET)
IronPort-SDR: 6SAywtD4PaTEygu4/45SkmSubgtlpgh6995C+q4iZPd2rsQ0hh/BPUatImvWFxxmejxtkR55T4
 0s5vGWFT5CJg==
X-IronPort-AV: E=McAfee;i="6000,8403,9889"; a="181955922"
X-IronPort-AV: E=Sophos;i="5.81,165,1610438400"; d="scan'208";a="181955922"
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 09 Feb 2021 07:06:24 -0800
IronPort-SDR: sXbglYLR6SUzhkcQ5hdLwLfD2DyGJMieRu/2vN61GaCVYU4LQOp7M0NYeCAhd3dIWx1rPKklYl
 wMqZNTgO+tdA==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.81,165,1610438400"; d="scan'208";a="488148309"
Received: from silpixa00399752.ir.intel.com (HELO
 silpixa00399752.ger.corp.intel.com) ([10.237.222.27])
 by fmsmga001.fm.intel.com with ESMTP; 09 Feb 2021 07:06:23 -0800
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org,
 Alexandre Ferrieux <alexandre.ferrieux@orange.com>,
 David Marchand <david.marchand@redhat.com>
Date: Tue,  9 Feb 2021 15:06:20 +0000
Message-Id: <20210209150621.1829753-1-ferruh.yigit@intel.com>
X-Mailer: git-send-email 2.29.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] [PATCH] log/linux: make default output stderr
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

In Linux by default DPDK log goes to stdout, as well as syslog.

It is possible for an application to change the library output stream
via 'rte_openlog_stream()' API, to set it to stderr, it can be used as:
rte_openlog_stream(stderr);

But still updating the default log output to 'stderr'.

Bugzilla ID: 8
Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Reported-by: Alexandre Ferrieux <alexandre.ferrieux@orange.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: David Marchand <david.marchand@redhat.com>
---
 lib/librte_eal/linux/eal_log.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/linux/eal_log.c b/lib/librte_eal/linux/eal_log.c
index 43c8460bfb07..2095df74c52c 100644
--- a/lib/librte_eal/linux/eal_log.c
+++ b/lib/librte_eal/linux/eal_log.c
@@ -27,9 +27,9 @@ console_log_write(__rte_unused void *c, const char *buf, size_t size)
 {
 	ssize_t ret;
 
-	/* write on stdout */
-	ret = fwrite(buf, 1, size, stdout);
-	fflush(stdout);
+	/* write on stderr */
+	ret = fwrite(buf, 1, size, stderr);
+	fflush(stderr);
 
 	/* Syslog error levels are from 0 to 7, so subtract 1 to convert */
 	syslog(rte_log_cur_msg_loglevel() - 1, "%.*s", (int)size, buf);
-- 
2.29.2