RedisVL breaks existing logging configurations
Closed this issue ยท 3 comments
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:
redis-vl-python/redisvl/utils/log.py
Line 18 in ad9bb21
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 RedisVLThis 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 ๐
Thanks for reporting this! We are working on a fix/improvement. Definitely frustrating.
@duc00 we've merged this into our 0.5.0 release branched slated to go out in the next week. Thanks for reporting this!
@tylerhutcherson great! Thanks