diff --git a/include/zephyr/logging/log_core.h b/include/zephyr/logging/log_core.h index 41936eb6696..42ef6e99062 100644 --- a/include/zephyr/logging/log_core.h +++ b/include/zephyr/logging/log_core.h @@ -251,7 +251,7 @@ static inline char z_log_minimal_level_to_char(int level) } \ \ bool is_user_context = k_is_user_context(); \ - if (!IS_ENABLED(CONFIG_LOG_FRONTEND) && IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) && \ + if (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) && \ !is_user_context && _level > Z_LOG_RUNTIME_FILTER((_dsource)->filters)) { \ break; \ } \ @@ -335,7 +335,7 @@ static inline char z_log_minimal_level_to_char(int level) (const char *)(_data), (_len));\ break; \ } \ - if (!IS_ENABLED(CONFIG_LOG_FRONTEND) && IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) && \ + if (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) && \ !is_user_context && (_level) > Z_LOG_RUNTIME_FILTER(filters)) { \ break; \ } \ diff --git a/subsys/logging/log_msg.c b/subsys/logging/log_msg.c index b2b6aee9e21..c45eb2201da 100644 --- a/subsys/logging/log_msg.c +++ b/subsys/logging/log_msg.c @@ -57,8 +57,10 @@ static bool frontend_runtime_filtering(const void *source, uint32_t level) return true; } - /* If only frontend is used and log got here it means that it was accepted. */ - if (IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY)) { + /* If only frontend is used and log got here it means that it was accepted + * unless userspace is enabled then runtime filtering is done here. + */ + if (!IS_ENABLED(CONFIG_USERSPACE) && IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY)) { return true; }