From d32dc5a72876b8fbd9f750ba4130f79c1d77b807 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Fri, 19 Oct 2018 12:22:47 +0200 Subject: [PATCH 1/2] logging: Default to redirecting printk() through it Default to redirecting the printk() calls through the logging subsystem using the special logginng log_printk() function that encapsulates raw strings into buffers and prints them as-is, without any of the logger additional metadata. This has 2 advantages: * Removes potential race conditions between printk() and the logger backend usage of the UART or any other backend * Printsk the printk() statements in-order with the rest of the logs, since now by default printk() messages are deferred Disadvantages: * printk() statements are limited in length * Additional memory consumption by default Signed-off-by: Carles Cufi --- subsys/logging/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/logging/Kconfig b/subsys/logging/Kconfig index 55ed07e2a522d..7ac1316016144 100644 --- a/subsys/logging/Kconfig +++ b/subsys/logging/Kconfig @@ -185,6 +185,7 @@ config LOG_MAX_LEVEL config LOG_PRINTK bool "Enable processing of printk messages." + default y help LOG_PRINTK messages are formatted in place and logged unconditionally. From 876dcddcd24505653d43610979524848223d987d Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Fri, 19 Oct 2018 15:14:50 +0200 Subject: [PATCH 2/2] tests: kernel: printk: Disable deferred printk handling Since the printk test is verifying the standard printk functionality, ensure that printk is not being redirected to the logging subsystem. Signed-off-by: Carles Cufi --- tests/kernel/common/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/kernel/common/prj.conf b/tests/kernel/common/prj.conf index f978f03e3eb60..3b8db5ec9a918 100644 --- a/tests/kernel/common/prj.conf +++ b/tests/kernel/common/prj.conf @@ -1,4 +1,5 @@ CONFIG_ZTEST=y CONFIG_PRINTK=y CONFIG_LOG=y +CONFIG_LOG_PRINTK=n CONFIG_POLL=y