Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
examples/box/seeds/filesystem/** filter=lfs diff=lfs merge=lfs -text
experiments/kdd[[:space:]]2026/evaluation_outputs/*.json filter=lfs diff=lfs merge=lfs -text
experiments/kdd[[:space:]]2026/evaluation_outputs/**/*.json filter=lfs diff=lfs merge=lfs -text
28 changes: 28 additions & 0 deletions backend/src/platform/logging_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@
import sys


class ContentLengthErrorFilter(logging.Filter):
"""Filter out h11 Content-Length mismatch errors.

The errors don't affect client responses but create
noisy logs.
"""

def filter(self, record: logging.LogRecord) -> bool:
# Check the message
msg = record.getMessage()
if "Too much data for declared Content-Length" in msg:
return False
if "LocalProtocolError" in msg and "Content-Length" in msg:
return False

# Check exception info (for tracebacks logged with exc_info=True)
if record.exc_info:
exc_type, exc_value, _ = record.exc_info
if exc_value and "Content-Length" in str(exc_value):
return False

return True


def setup_logging():
root_logger = logging.getLogger()
root_logger.setLevel(logging.INFO)
Expand All @@ -18,5 +42,9 @@ def setup_logging():
if not root_logger.hasHandlers():
root_logger.addHandler(console_handler)

# Filter out noisy h11 Content-Length errors
content_length_filter = ContentLengthErrorFilter()
logging.getLogger("uvicorn.error").addFilter(content_length_filter)

logging.getLogger("sqlalchemy.engine").setLevel(logging.WARNING)
logging.getLogger("alembic").setLevel(logging.INFO)
Loading