How to enable logging of Ehcache
In my opinion setting the root logger level to ALL
is not a good idea.
This means that ALL
log messages of every level will get through (unless you set a threshold on your appenders).
Instead, I suggest you set a sensible root logger level, such as INFO
or WARN
, and then set the log level of individual loggers if you require more specific information.
This way you are not creating a forest of unnecessary information.
I suggest something like the below:
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>
<logger name="net.sf.ehcache">
<level value="DEBUG"/>
</logger>
<root>
<priority value ="INFO" />
<appender-ref ref="CONSOLE" />
</root>
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).