Spaces:
Sleeping
Sleeping
Claude Code Claude Opus 4.6 commited on
Commit ·
3dc48f5
1
Parent(s): b83c083
fix: Add logging filter to suppress CancelledError noise
Browse filesThe asyncio.CancelledError from Gradio's internal queue operations
during connection close is normal behavior and should not be logged
or counted as a runtime error.
This adds a logging filter to suppress:
- httpcore.connection DEBUG logs during close
- CancelledError messages from asyncio queues
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -33,6 +33,18 @@ LOGS_DIR.mkdir(parents=True, exist_ok=True)
|
|
| 33 |
# ========== Logging Configuration ==========
|
| 34 |
# Configure logging early to capture all events
|
| 35 |
LOGS_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
logging.basicConfig(
|
| 37 |
level=logging.DEBUG,
|
| 38 |
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
@@ -43,6 +55,9 @@ logging.basicConfig(
|
|
| 43 |
)
|
| 44 |
logger = logging.getLogger(__name__)
|
| 45 |
|
|
|
|
|
|
|
|
|
|
| 46 |
# ========== Critical Import Error Handler ==========
|
| 47 |
# This MUST come before any imports that might fail
|
| 48 |
_crash_log_path = Path.home() / ".openclaw" / "logs" / "crash.log"
|
|
|
|
| 33 |
# ========== Logging Configuration ==========
|
| 34 |
# Configure logging early to capture all events
|
| 35 |
LOGS_DIR.mkdir(parents=True, exist_ok=True)
|
| 36 |
+
|
| 37 |
+
# Filter to suppress CancelledError noise from Gradio's internal queues
|
| 38 |
+
class CancelledErrorFilter(logging.Filter):
|
| 39 |
+
def filter(self, record):
|
| 40 |
+
# Suppress DEBUG logs about httpcore connection close
|
| 41 |
+
if "httpcore.connection" in record.getName() and record.levelno <= logging.DEBUG:
|
| 42 |
+
return False
|
| 43 |
+
# Suppress CancelledError from asyncio queues (normal shutdown)
|
| 44 |
+
if "CancelledError" in record.getMessage():
|
| 45 |
+
return False
|
| 46 |
+
return True
|
| 47 |
+
|
| 48 |
logging.basicConfig(
|
| 49 |
level=logging.DEBUG,
|
| 50 |
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
|
|
| 55 |
)
|
| 56 |
logger = logging.getLogger(__name__)
|
| 57 |
|
| 58 |
+
# Add filter to root logger
|
| 59 |
+
logging.getLogger().addFilter(CancelledErrorFilter())
|
| 60 |
+
|
| 61 |
# ========== Critical Import Error Handler ==========
|
| 62 |
# This MUST come before any imports that might fail
|
| 63 |
_crash_log_path = Path.home() / ".openclaw" / "logs" / "crash.log"
|