Question

I want to trace all low-level output that the Jedis client sends via JedisCommands to the Redis server. Should I enable logging to achieve this?

Était-ce utile?

La solution

Do you want to trace the Redis commands or response?

If you want to trace commands, just use the monitor command. You can simply execute redis-cli monitor.

If you want to trace the response, it seems there are no logging mechanism in Jedis. You need to either modify your application code or edit Jedis source to add logging.


Update:

I think RedisToGo forbids monitor command because performance concern. Because Jedis didn't provide built-in logging mechanism, the most simple way is modify and built Jedis on your own.

In Jedis, all Redis command should go through the 2 sendCommand methods in redis.clients.jedis.Connection class. Just try to add 2 lines of code there for logging. Any logging library should be applicable, such as log4j, java.util.logging or even System.out.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top