Overview
The OpenShift Python Wrapper includes comprehensive logging capabilities to help you debug issues and monitor resource operations. You can control log verbosity and configure sensitive data handling.Log Levels
The wrapper supports standard Python logging levels:DEBUG: Detailed information for diagnosing problemsINFO: Confirmation that things are working as expected (default)WARNING: Indication that something unexpected happenedERROR: A serious problem occurredCRITICAL: A very serious error occurred
Setting Log Level
Using Environment Variable
The recommended way to set the log level is via environment variable:The log level must be set before importing the wrapper modules. Changes to the environment variable after import will not take effect.
Setting at Runtime
You can also configure logging programmatically:Log Output Examples
INFO Level (Default)
At INFO level, you’ll see high-level operations:DEBUG Level
At DEBUG level, you’ll see detailed operation information:Command Execution Logging
When executing commands in pods, the wrapper logs execution details:Sensitive Data Handling
By default, the wrapper hashes sensitive information in logs for security:Disable Log Hashing
In secure environments (like local development), you can disable hashing:Custom Logger Configuration
Configure Logger Per Module
Configure logging for specific modules:Custom Log Format
Customize the log output format:Log to File
Direct logs to a file instead of console:Log to Both File and Console
Troubleshooting with Logs
Debugging Resource Creation Issues
Debugging Command Execution
Debugging Wait Operations
Configuration Best Practices
- Use INFO for Production: Keep default INFO level in production
- DEBUG for Development: Use DEBUG only when troubleshooting
- Secure Sensitive Data: Keep log hashing enabled in shared environments
- Log to Files: Use file logging for long-running operations
- Rotate Logs: Implement log rotation for production systems
- Filter Noise: Configure specific modules to reduce log volume
- Monitor Log Size: Watch log file sizes when DEBUG is enabled