Summary
Importing redisvl.query currently mutates the root logger at import time and routes logs to sys.stdout.
That breaks any process using stdout as a protocol transport, including stdio-based MCP/JSON-RPC servers.
Why this is a problem
A library import should not:
- call
logging.basicConfig(...)
- configure the root logger
- default logs to
stdout
In this case, importing RedisVL causes unrelated application logs to appear on stdout, which corrupts stdio protocols.
Repro
import logging
import sys
logging.getLogger().handlers.clear()
logging.getLogger().setLevel(logging.WARNING)
import redisvl.query
root = logging.getLogger()
print(root.handlers)
print(root.level)
print(getattr(root.handlers[0], "stream", None) is sys.stdout)
Observed behavior
After importing redisvl.query:
- a root
StreamHandler is installed
- the root logger level changes
- the handler writes to
sys.stdout
In our case this surfaced as stdio MCP transport failures because log lines were emitted on the same stdout stream as JSON-RPC messages.
Expected behavior
Importing RedisVL should not mutate the root logging configuration.
If RedisVL wants library logging, a safer pattern would be one of:
- attach a handler only to RedisVL's own logger
- use
logging.NullHandler()
- leave handler configuration entirely to the application
Also, libraries generally should not default logs to stdout.
Likely source
redisvl/utils/log.py appears to call logging.basicConfig(..., stream=sys.stdout), and redisvl/query/query.py calls get_logger(__name__) at import time.
That combination means import redisvl.query has global side effects immediately.
If useful, I can open a follow-up PR with a minimal fix.
Summary
Importing
redisvl.querycurrently mutates the root logger at import time and routes logs tosys.stdout.That breaks any process using stdout as a protocol transport, including stdio-based MCP/JSON-RPC servers.
Why this is a problem
A library import should not:
logging.basicConfig(...)stdoutIn this case, importing RedisVL causes unrelated application logs to appear on stdout, which corrupts stdio protocols.
Repro
Observed behavior
After importing
redisvl.query:StreamHandleris installedsys.stdoutIn our case this surfaced as stdio MCP transport failures because log lines were emitted on the same stdout stream as JSON-RPC messages.
Expected behavior
Importing RedisVL should not mutate the root logging configuration.
If RedisVL wants library logging, a safer pattern would be one of:
logging.NullHandler()Also, libraries generally should not default logs to stdout.
Likely source
redisvl/utils/log.pyappears to calllogging.basicConfig(..., stream=sys.stdout), andredisvl/query/query.pycallsget_logger(__name__)at import time.That combination means
import redisvl.queryhas global side effects immediately.If useful, I can open a follow-up PR with a minimal fix.