Skip to content

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

Description

@vishal-bala

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions