Caching Ehcache RMI复制不工作。需要知道如何可视化复制?
我已经使用RMI设置了我的ehcache复制。但是,我没有看到任何复制发生也没有收到任何错误。 你能看一看,让我知道我哪里出了问题吗?我已经尝试了自动和手动发现模式,但都没有用 我已为net.sf层次结构启用了跟踪日志记录功能,但我没有看到任何活动*。请告诉我如何通过日志可视化复制?要添加的类别等* 我的测试场景 我在host1上访问jsp,然后在host2上访问jsp。当我返回host1时,我希望看到一些复制日志或复制值返回,但我没有看到。 谢谢你的帮助。我已经为此奋斗了很长一段时间了 我的配置如下所示Caching Ehcache RMI复制不工作。需要知道如何可视化复制?,caching,replication,ehcache,Caching,Replication,Ehcache,我已经使用RMI设置了我的ehcache复制。但是,我没有看到任何复制发生也没有收到任何错误。 你能看一看,让我知道我哪里出了问题吗?我已经尝试了自动和手动发现模式,但都没有用 我已为net.sf层次结构启用了跟踪日志记录功能,但我没有看到任何活动*。请告诉我如何通过日志可视化复制?要添加的类别等* 我的测试场景 我在host1上访问jsp,然后在host2上访问jsp。当我返回host1时,我希望看到一些复制日志或复制值返回,但我没有看到。 谢谢你的帮助。我已经为此奋斗了很长一段时间了 我的配
<cache name="reportsCache"
maxElementsInMemory="1000"
maxElementsOnDisk="100"
eternal="false"
overflowToDisk="true"
timeToIdleSeconds="15"
timeToLiveSeconds="15"
statistics="true">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true,
replicatePuts=true,
replicatePutsViaCopy=true,
replicateUpdates=true,
replicateUpdatesViaCopy=true,
replicateRemovals=true" />
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
主机1上的
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//host2:40001/reportsCache"/>
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostname=host1, port=40001, socketTimeoutMillis=3000"/>
主机2上的
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//host1:40001/reportsCache"/>
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostname=host2, port=40001, socketTimeoutMillis=3000"/>
我的ehcache配置如下所示
<cache name="reportsCache"
maxElementsInMemory="1000"
maxElementsOnDisk="100"
eternal="false"
overflowToDisk="true"
timeToIdleSeconds="15"
timeToLiveSeconds="15"
statistics="true">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true,
replicatePuts=true,
replicatePutsViaCopy=true,
replicateUpdates=true,
replicateUpdatesViaCopy=true,
replicateRemovals=true" />
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
这样没有问题。我认为我的测试有点偏离了标准。 我从两个节点(通过2个diff browser会话)访问同一个jsp,并依靠我的日志查看关于复制的提示。我只是改变了查看jsp上的内容/数据的方法,我看到另一个节点在第一个节点上的点击被更新后获取相同的数据。所以这对于我的测试来说已经足够了。 但是,我仍然很想知道如何查看有关复制事件的日志? 我也打开了ehcache调试器的一个实例,但我没有看到任何东西出现。
如果这里有人可以告诉我如何查看与复制事件相关的日志,那将非常好。为了记录,我已将net.sf包的日志级别设置为TRACE。所使用的相关日志程序称为
net.sf.ehcache.distribution.rmichacheper
,您必须在其中启用调试级别
如何配置记录器实际上取决于日志框架。对于log4j,您可以在log4j.properties
文件中使用如下内容:
log4j.logger.net.sf.ehcache.distribution.RMICachePeer=DEBUG
对于log4j2,将以下内容放入log4j2.xml
:
<loggers>
...
<logger name="net.sf.ehcache.distribution.RMICachePeer" level="debug" />
</logger>
...
您知道如何启用日志记录吗?您可以从java bin目录中使用jconsole来查看ehcache对象