<a href="http://yulimin.javaeye.com/blog/30826">http://yulimin.javaeye.com/blog/30826</a>
問題是debug之後我也不清楚應該看哪裡!
debug的資訊實在是太多,很難看全!
能否給個執行個體,指出那裡顯示了使用了二級緩存!
對log4j進行分類分級一下,我的如下,你可以進行修改:
代碼
log4j.threshold = all
log4j.rootlogger = all
#
log4j.category.org.springframework debug,frameworkspring
log4j.category.org.hibernate debug,frameworkhibernate
log4j.category.net.sf.ehcache debug,frameworkehcache
log4j.appender.frameworkspring org.apache.log4j.dailyrollingfileappender
log4j.appender.frameworkspring.file ${system.logpath}/frameworkspring.log
log4j.appender.frameworkspring.datepattern yyyy-mm-dd'.log'
log4j.appender.frameworkspring.layout org.apache.log4j.patternlayout
log4j.appender.frameworkspring.layout.conversionpattern [%c]-[%p] %m%n
log4j.appender.frameworkspring.append false
log4j.appender.frameworkhibernate org.apache.log4j.dailyrollingfileappender
log4j.appender.frameworkhibernate.file ${system.logpath}/frameworkhibernate.log
log4j.appender.frameworkhibernate.datepattern yyyy-mm-dd'.log'
log4j.appender.frameworkhibernate.layout org.apache.log4j.patternlayout
log4j.appender.frameworkhibernate.layout.conversionpattern [%c]-[%p] %m%n
log4j.appender.frameworkhibernate.append false
log4j.appender.frameworkehcache org.apache.log4j.dailyrollingfileappender
log4j.appender.frameworkehcache.file ${system.logpath}/frameworkehcache.log
log4j.appender.frameworkehcache.datepattern yyyy-mm-dd'.log'
log4j.appender.frameworkehcache.layout org.apache.log4j.patternlayout
log4j.appender.frameworkehcache.layout.conversionpattern [%c]-[%p] %m%n
log4j.appender.frameworkehcache.append false
可以看到命中的資訊
[net.sf.ehcache.store.memorystore]-[debug] xxx.xxx.xyzcache: xxx.xxx.xyzmemorystore hit for xxx.xxx.xyz#8
沒命中的資訊:
[net.sf.ehcache.cache]-[debug] xxx.xxx.xyz cache - miss
大概是這樣子的,可以繼續進行觀察它的詳細log資訊再做分析。
增加一些資訊:
ehcache初始化的資訊
[net.sf.ehcache.cachemanager]-[debug] configuring ehcache from classpath.
[net.sf.ehcache.config.configurationfactory]-[debug] configuring ehcache from ehcache.xml found in the classpath: file:xxx/web-inf/classes/ehcache.xml
[net.sf.ehcache.config.configurationfactory]-[debug] configuring ehcache from url: file:xxx/web-inf/classes/ehcache.xml
[net.sf.ehcache.config.configurationfactory]-[debug] configuring ehcache from inputstream
[net.sf.ehcache.config.diskstoreconfiguration]-[debug] disk store path: xxx
[net.sf.ehcache.config.configurationhelper]-[debug] no cachemanagereventlistenerfactory class specified. skipping...
[net.sf.ehcache.config.configurationhelper]-[debug] no cachepeerlistenerfactoryconfiguration specified. not configuring a cachemanagerpeerlistener.
[net.sf.ehcache.config.configurationhelper]-[debug] no bootstrapcacheloaderfactory class specified. skipping...
ehcache開始工作的資訊
[net.sf.ehcache.store.diskstore]-[debug] deleting data file xxx.xxx.xyz.data
[net.sf.ehcache.store.memorystore]-[debug] initialized net.sf.ehcache.store.lrumemorystore for xxx.xxx.xyz
[net.sf.ehcache.store.lrumemorystore]-[debug] xxx.xxx.xyz cache: using spoolinglinkedhashmap implementation
[net.sf.ehcache.cache]-[debug] initialised cache: xxx.xxx.xyz