Spring cache logging on @Cacheable hit

后端 未结 4 879
花落未央
花落未央 2021-02-05 03:08

Currently I am working with a Spring Cache and the @Cacheable/@CacheEvict annotations.

I would like to get some sort of a console log statement

4条回答
  •  礼貌的吻别
    2021-02-05 03:45

    I don't think it is a good idea to open trace log all the time, even it is only for cache log.
    The better way is, EHcache has this hit/miss metrics already, you can get it by JMX or spring boot actuator.

    To use by JMX, you can refer this

    To use Spring Boot Actuator, you can refer this.

提交回复
热议问题