简体   繁体   English

ehcache和日志记录问题

[英]ehcache and logging issue

Some days ago I started using ehcache in web app. 几天前,我开始在网络应用程序中使用ehcache。 All was fine, and I do remember that when ehcache was putting something in the cach, or retrieving existing value from cache - it was written in the log files. 一切都很好,我确实记得当ehcache在缓存中放入某些东西,或从缓存中检索现有值时 - 它写在日志文件中。 I do not know what was changed since that time, and now ehcache is still working (I checked it attentively, in debug mode too), but without any logging. 我不知道自那时以来发生了什么变化,现在ehcache仍在工作(我在调试模式下仔细检查了它),但没有任何记录。

What can be the cause of such behaviour? 这种行为的原因是什么?

The list of ehcache & log dependencies in my maven project: 我的maven项目中的ehcache和日志依赖项列表:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.6.1</version>
</dependency>   
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.6.1</version>
</dependency>   
 <dependency>
    <groupId>com.googlecode.ehcache-spring-annotations</groupId>
    <artifactId>ehcache-spring-annotations</artifactId>
    <version>1.2.0</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <scope>provided</scope>
</dependency>

I can assure that log4j.properties was not changed since that time. 我可以确保log4j.properties从那时起没有改变。

To get put/gets/removes and so on logged, the cache needs to have statistics enabled. 要记录put / gets / removed等,缓存需要启用统计信息。 You can control this either programmatically or in your ehcache.xml. 您可以通过编程方式或在ehcache.xml中对此进行控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM