http://yulimin.javaeye.com/blog/30826
问题是DEBUG之后我也不清楚应该看哪里!
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