Skip to content

fix(log): show warnings when logging is not configured - #791

Open
hippi345 wants to merge 1 commit into
redis:mainfrom
hippi345:fix-786
Open

hippi345 wants to merge 1 commit into
redis:mainfrom
hippi345:fix-786

Conversation

@hippi345

@hippi345 hippi345 commented Oct 27, 2026 •

Copy link
Copy Markdown

Motivation

RedisVL warnings never reach an application that has not configured logging, including warnings that signal lost data (#786).

get_logger attached a logging.NullHandler whenever a logger had no handlers. A WARNING record with no handler in the hierarchy normally goes to logging.lastResort (stderr), but a NullHandler counts as a handler, so the record was dropped.

Changes

get_logger no longer attaches a handler; it returns logging.getLogger(name). Warnings and errors now reach stderr when logging is unconfigured. Applications that configure logging are unaffected: RedisVL loggers still propagate, and nothing calls basicConfig or replaces handlers.

tests/unit/test_log.py checks this in a fresh interpreter and reads stderr, since caplog installs its own handler and would pass even when the NullHandler swallows the record. Both new tests fail with the NullHandler restored and pass with the fix.

Notes

Existing handlers, including a NullHandler attached earlier in the same process, are left in place. INFO and DEBUG stay quiet when logging is unconfigured, matching standard-library behavior.

Release Notes

RedisVL warnings and errors now show on stderr when the application has not configured logging.

Fixes #786


Note

Low Risk
Small logging-helper change with subprocess tests; configured apps still propagate normally, with only unconfigured apps gaining stderr visibility for WARNING+.

Overview
Fixes silent RedisVL warnings when the host app has not set up logging (e.g. data-loss warnings in #786).

get_logger stops attaching a NullHandler. That handler counted as “handled,” so WARNING/ERROR never reached Python’s logging.lastResort on stderr. The function now only returns logging.getLogger(name) with an updated docstring explaining the behavior.

New unit tests in test_log.py spawn a fresh interpreter and assert on stderr/stdout, because pytest caplog would mask the old bug. They cover: no handlers on the returned logger, unconfigured apps seeing warnings/errors on stderr (matching a plain logger), and configured basicConfig still receiving RedisVL warnings on the app stream.

Reviewed by Cursor Bugbot for commit f9584bd. Bugbot is set up for automated code reviews on this repo. Configure here.

get_logger attached a NullHandler, which counts as a handler and stops
Python from sending WARNING and above to logging.lastResort. Drop it so
an application that has not configured logging still sees RedisVL
warnings on stderr.

Fixes redis#786

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit f9584bd. Configure here.

Comment thread redisvl/utils/log.py
if not logger.handlers:
logger.addHandler(logging.NullHandler())
return logger
return logging.getLogger(name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI failures dump traceback to stderr

Medium Severity

Removing the NullHandler from get_logger sends unconfigured records to logging.lastResort. The rvl CLI never configures logging and already prints failures to stderr, so logger.error(..., exc_info=True) now also emits a traceback and a duplicate error line on every command failure.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f9584bd. Configure here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant