【发布时间】:2019-03-26 08:10:58
【问题描述】:
在下面这样的类中有一个方法:
@Override
@Transactional
@Cacheable(value = "products", key = "#id")
public Product getProduct(long id) throws ApplicationException {
Product product = null;
try {
ProductEntity productEntity = productDAO.getProduct(id);
product = productTransformer.toProduct(productEntity);
} catch (SystemException ex) {
throw new ApplicationException(ex.getCode(), ex.getMessage(), "Problem in DataLayer", "Data Layer Error",
new Object[] { ex });
}
return product;
}
应用程序运行良好。但是当数据放入缓存时,我希望有一个缓存命中日志。我想通过 log4j.properties 记录它。
如何配置 application.properties 以便记录?
【问题讨论】:
标签: java spring spring-boot ehcache jcache