DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/4] log: increase default level to info
Date: Fri, 22 Apr 2016 15:43:58 +0200	[thread overview]
Message-ID: <1461332640-24273-3-git-send-email-thomas.monjalon@6wind.com> (raw)
In-Reply-To: <1461332640-24273-1-git-send-email-thomas.monjalon@6wind.com>

The default was to compile every logs (including debug) and set
the default level to debug.
As some debug logs may hurt performance, a notice is added and the
default level is now info.

In order to enable debug logs, they must be compiled with
RTE_LOG_LEVEL=RTE_LOG_DEBUG and enabled at runtime with --log-level=8.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 config/common_base                         | 2 +-
 doc/guides/faq/faq.rst                     | 7 ++++---
 lib/librte_eal/common/eal_common_log.c     | 5 +++++
 lib/librte_eal/common/eal_common_options.c | 4 ++++
 scripts/test-build.sh                      | 1 +
 5 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/config/common_base b/config/common_base
index 1a54e4c..35d38d9 100644
--- a/config/common_base
+++ b/config/common_base
@@ -88,7 +88,7 @@ CONFIG_RTE_MAX_NUMA_NODES=8
 CONFIG_RTE_MAX_MEMSEG=256
 CONFIG_RTE_MAX_MEMZONE=2560
 CONFIG_RTE_MAX_TAILQ=32
-CONFIG_RTE_LOG_LEVEL=8
+CONFIG_RTE_LOG_LEVEL=RTE_LOG_INFO
 CONFIG_RTE_LOG_HISTORY=256
 CONFIG_RTE_LIBEAL_USE_HPET=n
 CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
diff --git a/doc/guides/faq/faq.rst b/doc/guides/faq/faq.rst
index 368374f..3228b92 100644
--- a/doc/guides/faq/faq.rst
+++ b/doc/guides/faq/faq.rst
@@ -88,9 +88,7 @@ the wrong socket, the application simply will not start.
 On application startup, there is a lot of EAL information printed. Is there any way to reduce this?
 ---------------------------------------------------------------------------------------------------
 
-Yes, each EAL has a configuration file that is located in the /config directory. Within each configuration file, you will find CONFIG_RTE_LOG_LEVEL=8.
-You can change this to a lower value, such as 6 to reduce this printout of debug information. The following is a list of LOG levels that can be found in the rte_log.h file.
-You must remove, then rebuild, the EAL directory for the change to become effective as the configuration file creates the rte_config.h file in the EAL directory.
+Yes, the option ``--log-level=`` accepts one of these numbers:
 
 .. code-block:: c
 
@@ -103,6 +101,9 @@ You must remove, then rebuild, the EAL directory for the change to become effect
     #define RTE_LOG_INFO 7U     /* Informational. */
     #define RTE_LOG_DEBUG 8U    /* Debug-level messages. */
 
+It is also possible to change the maximum (and default level) at compile time
+with ``CONFIG_RTE_LOG_LEVEL``.
+
 
 How can I tune my network application to achieve lower latency?
 ---------------------------------------------------------------
diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index 1ae8de7..64aa79f 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -333,5 +333,10 @@ rte_eal_common_log_init(FILE *default_log)
 
 	default_log_stream = default_log;
 	rte_openlog_stream(default_log);
+
+#if RTE_LOG_LEVEL >= RTE_LOG_DEBUG
+	RTE_LOG(NOTICE, EAL, "Debug logs available - lower performance\n");
+#endif
+
 	return 0;
 }
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 2b418d5..3efc90f 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -139,7 +139,11 @@ eal_reset_internal_config(struct internal_config *internal_cfg)
 
 	internal_cfg->syslog_facility = LOG_DAEMON;
 	/* default value from build option */
+#if RTE_LOG_LEVEL >= RTE_LOG_DEBUG
+	internal_cfg->log_level = RTE_LOG_INFO;
+#else
 	internal_cfg->log_level = RTE_LOG_LEVEL;
+#endif
 
 	internal_cfg->xen_dom0_support = 0;
 
diff --git a/scripts/test-build.sh b/scripts/test-build.sh
index 9de90f7..9685dea 100755
--- a/scripts/test-build.sh
+++ b/scripts/test-build.sh
@@ -138,6 +138,7 @@ config () # <directory> <target> <options>
 		! echo $3 | grep -q '+shared' || \
 		sed -ri         's,(SHARED_LIB=)n,\1y,' $1/.config
 		! echo $3 | grep -q '+debug' || ( \
+		sed -ri     's,(RTE_LOG_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config
 		sed -ri           's,(_DEBUG.*=)n,\1y,' $1/.config
 		sed -ri            's,(_STAT.*=)n,\1y,' $1/.config
 		sed -ri 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config )
-- 
2.7.0

  parent reply	other threads:[~2016-04-22 13:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 13:43 [dpdk-dev] [PATCH 0/4] cleanup debug and dead code Thomas Monjalon
2016-04-22 13:43 ` [dpdk-dev] [PATCH 1/4] eal: increase log level of some messages Thomas Monjalon
2016-04-22 13:43 ` Thomas Monjalon [this message]
2016-04-22 13:43 ` [dpdk-dev] [PATCH 3/4] examples: remove useless debug flags Thomas Monjalon
2016-04-28 20:15   ` Yuanhan Liu
2016-04-22 13:44 ` [dpdk-dev] [PATCH 4/4] eal: add assert macro for debug Thomas Monjalon
2016-04-22 19:51   ` Yuanhan Liu
2016-04-22 21:14     ` Thomas Monjalon
2016-04-22 22:08       ` Yuanhan Liu
2016-04-22 22:42         ` Stephen Hemminger
2016-04-29  9:04           ` Thomas Monjalon
2016-05-02 13:37 ` [dpdk-dev] [PATCH 0/4] cleanup debug and dead code Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461332640-24273-3-git-send-email-thomas.monjalon@6wind.com \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).