Skip to content

RedisVL breaks existing logging configurations #293

Closed

Description

@duc00

Hi,

Thank you for this very helpful repo. Redis has always been and is still total 🔥.

Simply importing some structures from RedisVL breaks existing logging configurations, because they get overridden by the following function call:

coloredlogs.install(level=log_level, logger=logger, fmt=fmt, stream=sys.stdout)

Here is a simple reproducer:

import logging
import sys

handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(
    logging.Formatter(
        "%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)s] %(message)s"
    )
)

root_logger = logging.getLogger()
root_logger.handlers = [handler]
root_logger.setLevel(logging.INFO)

my_logger = logging.getLogger("app")
my_logger.info("This is correctly formatted")

from redisvl.query.filter import Text

my_logger.info("This is NOT correctly formatted and has been overridden by RedisVL")

Output:

➜  redisvl-issue-log poetry run python redisvl_issue_log/repro.py
2025-02-28 18:18:24,036 INFO [app] [repro.py:16] This is correctly formatted
18:18:24 app INFO   This is NOT correctly formatted and has been overridden by RedisVL

This is a very frustrating issue, since it is happening silently at the first RedisVL import. I spent a few hours pinning to this repository. I believe many could have encountered such issues trying to configure general logging, and gave up figuring it out.

Could we disable coloredlogs or at least make sure importing objects outside of CLI does not trigger its installation on the root logger?

Many thanks 🙏

Activity

  1. tylerhutcherson commented on Mar 25, 2025

    @tylerhutcherson
    Collaborator

    Thanks for reporting this! We are working on a fix/improvement. Definitely frustrating.

  2. tylerhutcherson commented on Mar 26, 2025

    @tylerhutcherson
    Collaborator

    @duc00 we've merged this into our 0.5.0 release branched slated to go out in the next week. Thanks for reporting this!

  3. duc00 commented on Mar 26, 2025

    @duc00
    Author

    @tylerhutcherson great! Thanks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions