Fixing Python UnicodeDecodeError in Logging Handlers - Nginx Upstream Connection Refused: Diagnosis and Fixes-Fix ERR_NAME_NOT_RESOLVED by Clearing DNS Cache

Result check
- Keep one change per test run so you know which step helped.
- Undo temporary changes after the issue is confirmed.