Closed iDataist closed 1 year ago
By default we only add a Nulllogger to the package level here https://github.com/Grokzen/redis-py-cluster/blob/master/rediscluster/__init__.py#L58 anything outside of that would have to be on your end.
Are you sure you dont have to configure your logger before importing rediscluster to get the config setup properly?
I think you have to really inspect each logger with pdb where the log events happen and see why your loggers default to INFO. But also note that you have only set logging level to ERROr for the rediscluster.connection instance and not the rediscluster.client instance where your log messages comes from
Hi @Grokzen, I truly appreicate your fast response. I incorporated your advice and moved importing rediscluster after configuring the logging. Below is the code that worked. Thank you!
import logging
logging.getLogger("rediscluster.connection").setLevel(logging.ERROR)
from rediscluster import RedisCluster
redis = RedisCluster(startup_nodes=[{"host": "clustercfg.*****.*****.usw2.cache.amazonaws.com","port": "6379"}],
decode_responses=True,
skip_full_coverage_check=True,
ssl=True,
username="default",
password="****",)
if redis.ping():
logging.info("Connected to Redis")
I have no idea really why logging behaves like this but I remember it being like that. I guess it depends on the object create order because the log object within the file is created before and then it gets whatever config is at that point in time. I also always have been under the impression that python logging used singleton global objects for loggers and updating one would set it for everything and all created logger objects already present.
I was not aware of this behavior. Thanks again for sharing your knowledge on this, @Grokzen!
I used the code below but it does not impact the verbose logging. Is there a way to turn the vervose logging off?
The log looks like this:
Versions: