测试了一下,spring-boot-starter-data-redis确实没有相关配置可以输出。依据 https://github.com/spring-projects/spring-data-redis/issues/1586 和https://github.com/spring-projects/spring-data-redis/issues/1321 。只能自己实现,或者使用Redis自带的monitor命令。不过,像Redisson这种是可以输出的RedisClientConfig redisClientConfig = new RedisClientConfig(); redisClientConfig.setAddress("localhost", 6379); RedisClient client = RedisClient.create(redisClientConfig); final RedisConnection conn = client.connect(); final Object test = conn.sync(StringCodec.INSTANCE, RedisCommands.SET, "test", 0);配置日志等级 "org.redisson": trace得到2023-03-21T08:28:16.691+08:00 TRACE 66205 --- [ntLoopGroup-4-2] o.r.client.handler.CommandEncoder : channel: [id: 0xeab76aaa, L:/127.0.0.1:56970 - R:localhost/127.0.0.1:6379] message: *3 $3 SET $4 test $1 0 2023-03-21T08:28:16.718+08:00 TRACE 66205 --- [ntLoopGroup-4-2] o.r.client.handler.CommandDecoder : reply: +OK即原始的RESP格式本文参与了SegmentFault 思否面试闯关挑战赛,欢迎正在阅读的你也加入。
测试了一下,
spring-boot-starter-data-redis确实没有相关配置可以输出。依据 https://github.com/spring-projects/spring-data-redis/issues/1586 和https://github.com/spring-projects/spring-data-redis/issues/1321 。
只能自己实现,或者使用Redis自带的
monitor命令。不过,像
Redisson这种是可以输出的配置日志等级
"org.redisson": trace得到
即原始的
RESP格式