java - How to remove the Ehcache WARN messages when using Hibernate -
i have ehcache xml configuration:
<ehcache> <defaultcache maxelementsinmemory="10000" eternal="false" timetoidleseconds="120" timetoliveseconds="120" overflowtodisk="false" diskspoolbuffersizemb="30" diskpersistent="false" diskexpirythreadintervalseconds="120" memorystoreevictionpolicy="lru" /> </ehcache>
and also, have packages entities (around 150). if deploy application on tomcat server, there lot warn messages in log:
2015-04-29 11:59:02,712 [rmi tcp connection(3)-127.0.0.1] warn org.hibernate.cache.ehcache.abstractehcacheregionfactory - hhh020003: not find specific ehcache configuration cache named [com.company.project.entity.package.myentity]; using defaults.
i can write configuration each entity -
<cache name="com.company.project.entity.package.myentity" maxentrieslocalheap="50" eternal="false" overflowtodisk="false" timetoliveseconds="120"> <persistence strategy="localtempswap"/> </cache>
but in way, configuration file become large (1600 rows). think there exist way set default config each entity , kill warn messages, don't know how it. if know, please help. many thanks.
this hibernate ehcache cache region code logs warning message:
private ehcache getcache(string name) throws cacheexception { try { ehcache cache = manager.getehcache( name ); if ( cache == null ) { log.unabletofindehcacheconfiguration( name ); manager.addcache( name ); cache = manager.getehcache( name ); log.debug( "started ehcache region: " + name ); } hibernateehcacheutils.validateehcache( cache ); return cache; } catch (net.sf.ehcache.cacheexception e) { throw new cacheexception( e ); } }
as can see, have 2 options:
- you either declare cache region in
ehcache.xml
file. you set 'org.hibernate.cache.ehcache.abstractehcacheregionfactory' log level error:
for log4j2:
<logger name="org.hibernate.cache.ehcache.abstractehcacheregionfactory" level="error"> <appenderref ref="file"/> </logger>
Comments
Post a Comment