Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

RedisVL warnings are never shown when the application has not configured logging

未关闭 适合新手
#786 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
77/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python, redis
领域
backend

调研方向

从 redisvl/utils/log.py 开始,检查 get_logger 如何添加处理器。使用提供的脚本分别在 logging.basicConfig() 之前和之后复现该行为,然后检查有关未解析向量字段的警告的测试。完成标准是:在没有 logging 配置时,RedisVL 警告通过 lastResort 输出到 stderr,同时已配置的 logging 仍能正常工作。

由索引模型根据 Issue 内容生成。

描述

bug

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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

redis/redis-vl-python 的其他 Issue

查看 redis/redis-vl-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。