Skip to content
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

Merged
merged 4 commits into from
Oct 30, 2023

Conversation

dmccoystephenson
Copy link
Member

@dmccoystephenson dmccoystephenson commented Oct 24, 2023

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)

@dmccoystephenson dmccoystephenson changed the title Reference PPM_LOG_LEVEL in PpmLogger Reference PPM_LOG_LEVEL in PpmLogger + Fix script stalling Oct 26, 2023
@dmccoystephenson dmccoystephenson changed the title Reference PPM_LOG_LEVEL in PpmLogger + Fix script stalling Direct PPM_LOG_LEVEL Access and Stalling Prevention Oct 26, 2023
@@ -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");

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?

Copy link
Member Author

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.

Copy link

@payneBrandon payneBrandon left a 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

@payneBrandon payneBrandon merged commit 6fd125f into develop Oct 30, 2023
2 checks passed
@payneBrandon payneBrandon deleted the reference-log-level-env-directly branch October 30, 2023 18:15
dmccoystephenson pushed a commit that referenced this pull request Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants