diff --git a/samples/net/syslog_net/prj.conf b/samples/net/syslog_net/prj.conf index 890138056f5..e2564737b8c 100644 --- a/samples/net/syslog_net/prj.conf +++ b/samples/net/syslog_net/prj.conf @@ -14,6 +14,11 @@ CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5 CONFIG_NET_LOG=y CONFIG_LOG=y +# Immediate logging does not work with network syslog as it would cause +# the sent packet to be malformed (contains only 1 byte data) +CONFIG_LOG_IMMEDIATE=n +CONFIG_LOG_PROCESS_THREAD=y + CONFIG_NET_IPV6=y CONFIG_NET_IPV4=y CONFIG_NET_DHCPV4=n diff --git a/samples/net/syslog_net/src/main.c b/samples/net/syslog_net/src/main.c index 60848e8b003..2edb50ca1af 100644 --- a/samples/net/syslog_net/src/main.c +++ b/samples/net/syslog_net/src/main.c @@ -12,6 +12,8 @@ LOG_MODULE_REGISTER(net_syslog, LOG_LEVEL_DBG); #include #include +BUILD_ASSERT(IS_ENABLED(CONFIG_LOG_BACKEND_NET), "syslog backend not enabled"); + #define SLEEP_BETWEEN_PRINTS 3 void main(void) diff --git a/subsys/logging/Kconfig b/subsys/logging/Kconfig index 22d6acce787..e9a3880e3ac 100644 --- a/subsys/logging/Kconfig +++ b/subsys/logging/Kconfig @@ -465,9 +465,11 @@ config LOG_BACKEND_XTENSA_OUTPUT_BUFFER_SIZE Buffer is used by log_output module for preparing output data (e.g. string formatting). +# Immediate mode cannot be used with network backend as it would cause the sent +# rsyslog message to be malformed. config LOG_BACKEND_NET bool "Enable networking backend" - depends on NETWORKING + depends on NETWORKING && NET_UDP && !LOG_IMMEDIATE select NET_CONTEXT_NET_PKT_POOL help Send syslog messages to network server.