这是我从来没有真正完全理解的东西,不知道有没有人能解释一下?
我有一个使用休眠的弹簧应用程序。我有时在 tomcat 上运行它,有时在码头上运行它。我从hibernate和spring中得到日志输出。我知道在 java 日志记录方面有多种选择,例如 java.logging、slf4j、log4j 等;但根本没有真正参与配置日志记录。现在我想配置 ehcache 的日志输出,我需要!
我的问题是,在我的应用程序中,我如何知道它正在使用哪种日志记录,以及如何配置和微调它?它取决于应用程序服务器吗?或者是 Spring 或 Hibernate 引入了自己的日志记录实现。查看我的 maven 依赖树,我可以看到 hibernate-validator 引入了 org.jboss.logging,并且 spring 需要 commons-logging。我也有 slf4j,因为几个包需要不同的版本,所以我手动拉入了最新的一个。
Maven依赖项是:
[INFO] +- org.hibernate:hibernate-core:jar:3.6.10.Final:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] | \- javax.transaction:jta:jar:1.1:compile
[INFO] +- org.hibernate:hibernate-c3p0:jar:3.6.10.Final:compile
[INFO] | \- c3p0:c3p0:jar:0.9.1:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.5.8:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.5.8:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.5.8:compile
[INFO] +- net.sf.ehcache:ehcache-core:jar:2.6.6:compile
[INFO] +- xerces:xercesImpl:jar:2.10.0:compile
[INFO] | \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] +- com.vividsolutions:jts:jar:1.13:compile
[INFO] +- org.hibernatespatial:hibernate-spatial-postgis:jar:1.1:compile
[INFO] | \- org.hibernatespatial:hibernate-spatial:jar:1.1:compile
[INFO] +- postgresql:postgresql:jar:9.1-901-1.jdbc4:compile
[INFO] +- org.postgis:postgis-jdbc:jar:1.3.3:compile
[INFO] | \- org.postgis:postgis-stubs:jar:1.3.3:compile
[INFO] +- org.springframework:spring-expression:jar:3.1.2.RELEASE:compile
[INFO] | \- org.springframework:spring-core:jar:3.1.2.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-beans:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:3.1.2.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-context:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-oxm:jar:3.1.2.RELEASE:compile
[INFO] | \- commons-lang:commons-lang:jar:2.5:compile
[INFO] +- org.springframework:spring-web:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-aspects:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-instrument:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-instrument-tomcat:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-jms:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-asm:jar:3.1.4.RELEASE:compile
[INFO] +- org.aspectj:aspectjrt:jar:1.7.1:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.7.1:compile
[INFO] +- cglib:cglib:jar:2.2.2:compile
[INFO] | \- asm:asm:jar:3.3.1:compile
[INFO] +- org.springframework.security:spring-security-core:jar:3.1.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.1.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.1.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-aspects:jar:3.1.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:3.1.3.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-acl:jar:3.1.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-crypto:jar:3.1.3.RELEASE:compile
[INFO] +- org.hibernate:hibernate-validator:jar:4.3.1.Final:compile
[INFO] | +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] | \- org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile
[INFO] +- org.hibernate:hibernate-validator-annotation-processor:jar:4.3.1.Final:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.1.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.1.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.1.1:compile
[INFO] +- org.apache.velocity:velocity:jar:1.7:compile
[INFO] +- joda-time:joda-time:jar:2.1:compile
[INFO] +- javax.mail:mail:jar:1.4.5:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- jstl:jstl:jar:1.2:compile
[INFO] +- javaxt:javaxt-core:jar:1.5.10:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.2.2:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- org.springframework:spring-test:jar:3.1.2.RELEASE:test
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.mockito:mockito-all:jar:1.9.5:test
[INFO] +- org.glassfish:javax.servlet:jar:3.0:test
[INFO] +- javax:javaee-web-api:jar:6.0:provided
[INFO] \- javassist:javassist:jar:3.12.1.GA:compile
干杯,NVF