RedisVL warnings are never shown when the application has not configured logging
维护者通常 4 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 redisvl/utils/log.py 开始,检查 get_logger 如何添加处理器。使用提供的脚本分别在 logging.basicConfig() 之前和之后复现该行为,然后检查有关未解析向量字段的警告的测试。完成标准是:在没有 logging 配置时,RedisVL 警告通过 lastResort 输出到 stderr,同时已配置的 logging 仍能正常工作。
由索引模型根据 Issue 内容生成。
描述
Description
RedisVL's warnings never reach an application that has not configured logging, including the ones that signal lost data.
get_logger attaches a logging.NullHandler to every RedisVL logger (redisvl/utils/log.py). Since Python 3.2, a WARNING or higher record with no handler anywhere in the logger hierarchy goes to logging.lastResort, which prints it to stderr. A NullHandler counts as a handler, so it opts every RedisVL logger out of that fallback and the record is dropped.
That affects every get_logger call site in the library (22 on main). The most consequential is the warning #742 added for a vector field that from_existing cannot parse: the recovered schema is missing that field, and recreating the index from it drops the field. In the issue's own setting, a plain script with no logging configuration, the warning is never shown. The test for it passes only because pytest's caplog installs its own handler.
Reproduction
import logging
from redisvl.utils.log import get_logger
get_logger("redisvl.demo").warning("from redisvl logger")
logging.getLogger("plain.demo").warning("from plain logger")
On main, with Python 3.13, only from plain logger is printed. After logging.basicConfig(), the RedisVL warning appears.
Expected behaviour
With no logging configuration, RedisVL warnings and errors reach stderr through lastResort, as a standard-library logger's do. An application that configures logging is unaffected either way.
Proposed fix
Stop attaching the NullHandler in get_logger. It was only needed to silence the "No handlers could be found" message on Python 2 and early Python 3. It does not configure the root logger, so this keeps the behaviour that #443 and #445 asked for.
- 主要语言
- Python
- 星标
- 432
- 派生
- 111
- 平均合并
- 5 天 22 小时
- 30 天内合并 PR
- 13
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
redis/redis-vl-python 的其他 Issue
-
bug index
难度 2/5 1-3 小时 新手友好度 84/100
redis/redis-vl-python#787 ·
维护者通常 4 天内回复
-
exists() depends on exact FT.INFO error wording; an unrecognised "missing index" message makes create() never create the index (regression from #672)可能已有人在做 @nandanadileep 于 4 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
redis/redis-vl-python#773 · 1 条评论 ·
维护者通常 4 天内回复
-
Vector field with index_missing=True cannot be created可能已有人在做 @RaphaelFakhri 于 10 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
redis/redis-vl-python#770 ·
维护者通常 4 天内回复
-
Add Python 3.15 support可能已有人在做 @vishal-bala 于 11 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
redis/redis-vl-python#757 · 1 条评论 · 1 个 reaction ·
维护者通常 4 天内回复
-
SearchIndex.drop_keys does not validate cluster hash-tag co-location (inconsistent with drop_documents)可能已有人在做 @Hashim1999164 于 9 天前认领。 未关闭bug good first issue index
难度 2/5 1-3 小时 新手友好度 78/100
redis/redis-vl-python#601 ·
维护者通常 4 天内回复
查看 redis/redis-vl-python 的全部 Issue
相似的 Issue
-
bug P1
难度 2/5 1-3 小时 新手友好度 76/100
Toloka/tolokaforge#1947 ·
维护者通常 1 天内回复
-
SageMaker provider: streaming fails with NoStreamDataError on DJL Serving (LMI) endpoints可能已有人在做 @balajiaru 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
UKGovernmentBEIS/inspect_ai#6127 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
letsencrypt/cp-cps#361 ·
-
难度 2/5 1-3 小时 新手友好度 65/100