-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Direct PPM_LOG_LEVEL Access and Stalling Prevention #36
Conversation
src/ppmLogger.cpp
Outdated
@@ -13,7 +13,27 @@ PpmLogger::PpmLogger(std::string logname) { | |||
sinks.push_back(std::make_shared<spdlog::sinks::stdout_sink_mt>()); | |||
} | |||
setLogger(std::make_shared<spdlog::logger>("log", begin(sinks), end(sinks))); | |||
|
|||
// use PPM_LOG_LEVEL environment variable to set the log level | |||
std::string logLevelString = getEnvironmentVariable("PPM_LOG_LEVEL"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the PPM_LOG_LEVEL isn't set? or is set to say a number? When we try toLowercase
of those will we run into any issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If PPM_LOG_LEVEL isn't set, the default value will be used. If it is set to a number or anything else unrecognized, the default will also be used. I've added some comments to a few methods to make this clearer.
Since we read environment variables as strings, even if PPM_LOG_LEVEL is set to a number it will be treated as a string, so we won't run into any issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the one question to address
Sync master to develop
Changes
Modification in Use of PPM_LOG_LEVEL env var
Previously, the ppm_no_map.sh script referenced the PPM_LOG_LEVEL environment variable and used it to pass the 'v' opt string to the program. This 'v' opt string was then parsed in the 'PPM' class.
With these updates, the PpmLogger now directly accesses the PPM_LOG_LEVEL environment variable, eliminating the necessity for the 'v' opt string.
Manual Setting of PPM_LOG_LEVEL Environment Variable When Running the PPM Container via Scripts
The PPM_LOG_LEVEL has been adjusted to DEBUG in the standalone.sh and standalone_multi.sh scripts.
This adjustment prevents potential stalling issues during the PPM container's readiness checks, which have affected the execution of the
do_kafka_test.sh
script.It should be noted that this will not affect the default logging level during regular PPM operation.
Relevant PR Comment
These changes address the following USDOT PR comment:
usdot-jpo-ode#31 (comment)