Issue while changing log level at runtime #2218
Unanswered
skeleton18
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The first - export SPDLOG_LEVEL="*=off,default=warn"
+ export SPDLOG_LEVEL="off,default=warn" And should call |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm trying to change log levels at runtime but it is not working as I expected.
I am using spdlog 1.9.2.
Here is what I have done :
1/ In my header file I have just define
SPDLOG_ACTIVE_LEVEL
toSPDLOG_LEVEL_TRACE
before includingspdlog/spdlog.h
.2/ Then I declare 3 loggers:
spdlog::stdout_color_mt("default")
set with levelspdlog::level::debug
spdlog::stderr_color_mt("errorLogger")
set with levelspdlog::level::warn
spdlog::basic_logger_mt("fileLogger", "logs/basic-log.txt", true)
set with levelspdlog::level::trace
3/ Finally I wrote a simple main to log messages for each log level (trace, debug, info, warn, error and critical) using
SPDLOG_LOGGER_XXX
macros.When I run my main program setting
export SPDLOG_LEVEL="*=off,default=warn"
(i.e. disable all loggers but default, and change its log level to warn), it does not seem to work because I had the following output:What do I do wrong ?
Thanks for the help.
Beta Was this translation helpful? Give feedback.
All reactions