【发布时间】:2012-05-22 15:25:27
【问题描述】:
在我的 Spring + Hibernate 项目中,我使用 SLF4J 1.6.4 和 LogBack 进行日志记录。现在,我添加了 Ehcache 2.2.0(通过 ehcache-spring-annotations-1.1.3)。缓存似乎作为方法工作,用@Cacheable 注释,不再被执行,尽管返回正确的结果。但是,我有兴趣查看 Ehcache 编写的日志。由于 Ehcache 也使用 SLF4J,我想,应该将日志写入我的日志文件。但是,这并没有发生。 logback.xml 有以下内容。
<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ROLLING"/>
</root>
添加关注也无济于事
<logger name="net.sf.ehcache">
</logger>
Ehcache.xml
<cache name="sampleCache1"
eternal="false"
overflowToDisk="true"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LFU"
/>
请建议我解决这个问题。
Ehcache 使用的是 SLF4J 1.6.1,而我的项目使用的是 SLF4J 1.6.4。会不会有什么问题?
谢谢
【问题讨论】:
-
我刚刚发现 ehcache 并没有记录我所期望的所有内容。那么,如果 ehcache 确实记录了您期望的内容,您是否查看过它?
标签: spring ehcache slf4j logback