How to enable logging of Ehcache

ehcache, logback, slf4j, spring

Solution

EhCache logs a lot on `DEBUG` level. First of all, this configuration snippet filters out all logging statements below `INFO`:

<root level="info">

Change it to

<root level="ALL">

Secondly

<logger name="net.sf.ehcache">

needs an increased logging level

<logger name="net.sf.ehcache" level="ALL"/> 

You should then see plenty of logging statements from EhCache (and others).

Problem

In my Spring + Hibernate project, I was doing logging by SLF4J 1.6.4 with LogBack. Now, I've added Ehcache 2.2.0 (through ehcache-spring-annotations-1.1.3). The caching seems to be working as the method, annotated with @Cacheable, no longer being executed, though returning the correct result. But, I'm interested to see the log written by the Ehcache. As Ehcache also uses SLF4J, I supposed, the log should be written into my log file. But, this is not happening. The logback.xml has the following. ``` <root level="info"> <appender-ref ref="STDOUT"/> <appender-ref ref="ROLLING"/> </root> ``` Adding following also doesn't help ``` <logger name="net.sf.ehcache"> </logger> ``` Ehcache.xml ``` <cache name="sampleCache1" eternal="false" overflowToDisk="true" timeToIdleSeconds="300" timeToLiveSeconds="600" memoryStoreEvictionPolicy="LFU" /> ``` Please advise me to overcome the problem. The Ehcache is using SLF4J 1.6.1, while my project was using SLF4J 1.6.4. Can it cause any problem? Thanks

Original source