下面是我的 pom.xml 中的内容,有什么意见或改进吗? (这是针对 spring mvc 应用程序的)
我是否仍然需要排除公共(public)日志记录才能使用 slf4j?
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework-version}</version>
</dependency>
我在这样的项目中已经这样做了大约一年了,不确定事情是否已经改变或需要更新(特别是在设置日志记录方面)。
我讨厌的一件事是,当使用 IntelliJ 和 jetty(每 x 秒重新加载项目)时,我得到 java 内存不足(perm gen)错误,我相信这是因为日志记录中的泄漏Spring框架。
最佳答案
仅当包含 jcl-over-slf4j
时,才应排除 commons-logging
。更多信息请参阅:http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/overview.html#d0e787
关于泄漏:据我所知,没有适当的修复方法——您可以增加内存,但稍后会崩溃。这是 JRebel 的问题之一。可能有助于减少。
关于java - 使用 pom.xml 设置 Spring MVC,并使用 slfj 日志记录和泄漏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12505629/