Repository navigation
fix: handle case-insensitive LOG_LEVEL environment variable - #33
Merged
Merged
Conversation
The LOG_LEVEL environment variable from ConfigMaps may be lowercase (e.g., 'info') but Python's logging module requires uppercase (e.g., 'INFO'). Convert the log level to uppercase before passing it to logging.basicConfig() to handle both cases gracefully. Fixes CrashLoopBackOff issue where pods fail with: ValueError: Unknown level: 'info'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The high-command-mcp pods are in CrashLoopBackOff with the following error:
The ConfigMap
high-command-mcp-confighasLOG_LEVEL: info(lowercase), but Python'sloggingmodule requires uppercase log levels (e.g.,INFO,DEBUG,WARNING,ERROR).Solution
Convert the
LOG_LEVELenvironment variable to uppercase before passing it tologging.basicConfig(). This makes the code more robust and handles both lowercase and uppercase log level values gracefully.Changes
highcommand/server.pyto convertLOG_LEVELto uppercase using.upper()Testing
This fix resolves the CrashLoopBackOff issue. The code now accepts:
LOG_LEVEL=info(lowercase) ✅LOG_LEVEL=INFO(uppercase) ✅LOG_LEVEL=Info(mixed case) ✅Note
The ConfigMap is managed by Helm/GitOps, so direct patching won't persist. This code fix is the proper solution as it handles the case-insensitivity issue regardless of how the ConfigMap is configured.