Issue
I used VLOG to print log. VLOG is defined as below:
#define VLOG_IS_ON(lvl) \
((lvl) <= ::tensorflow::internal::LogMessage::MinVLogLevel())
#endif
#define VLOG(lvl) \
if (TF_PREDICT_FALSE(VLOG_IS_ON(lvl))) \
::tensorflow::internal::LogMessage(__FILE__, __LINE__, tensorflow::INFO)
const int INFO = 0; // base_logging::INFO;
const int WARNING = 1; // base_logging::WARNING;
const int ERROR = 2; // base_logging::ERROR;
const int FATAL = 3; // base_logging::FATAL;
const int NUM_SEVERITIES = 4; // base_logging::NUM_SEVERITIES;
If I configure the min log level with warning, I use export TF_CPP_MIN_VLOG_LEVEL=1
. What I want is for the log only to print WARNINGs including ERROR, FATAL, but in fact, it is only displaying WARNING and INFO logs which are called by:
VLOG(INFO) and VLOG(WARN)
Is this result reasonable? How can I adjust the log levels accordingly?
Solution
You control the log level via TF_CPP_MIN_LOG_LEVEL
(not TF_CPP_MIN_VLOG_LEVEL
), which you want to set to 1 in your case.
TF_CPP_MIN_VLOG_LEVEL
brings in extra debugging information and actually works the other way round: its default value is 0 and as it increases, more debugging messages are logged in.
So the VLOG
level is not your usual INFO
, WARNING
, etc. LOG
level, but something different and ranked inversely. If you peek into the code, you see that LOG
is used with log labels (LOG(INFO) << message
) but VLOG
is used with plain numbers (VLOG(2) << message
).
VLOG
messages are actually always logged at the INFO
log level. It means that in any case, you need a TF_CPP_MIN_LOG_LEVEL
of 0 to see any VLOG
message.
Answered By - P-Gn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.