- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我一直没有真正完全理解的东西,不知道有没有人能解释一下?
我有一个 spring 应用程序,使用 hibernate 。我有时在 tomcat 上运行它,有时在 jetty 上运行。我从 hibernate 和 spring 获得日志输出正常。我知道在 java 日志记录方面有多种选择,例如 java.logging、slf4j、log4j 等;但根本没有真正参与配置日志记录。现在我想配置 ehcache 的日志输出我需要!
我的问题是,在我的应用程序中,我如何知道它使用的是哪种日志记录,以及如何配置和微调它?它取决于应用程序服务器吗?或者是 spring 或 hibernate 引入了自己的日志记录实现。查看我的 Maven 依赖关系树,我可以看到 hibernate-validator 引入了 org.jboss.logging,而 spring 需要 commons-logging。我也有 slf4j,因为几个包需要不同版本,所以我手动引入了最新的一个。
[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
干杯,自然灾害
最佳答案
我的问题是,在我的应用程序中,我如何知道它使用的是哪种日志记录,以及如何配置和微调它?
首先你应该注意到commons logging不是日志框架,它只是不同日志框架之间的桥梁/门面。因此,如果一个框架使用公共(public)日志记录,那么您可以“配置”公共(public)日志记录以将日志记录语句转发到真正的日志记录框架(log4j、slf4j、java 日志记录...)
其次,您应该知道,如果一个框架(spring、hibernate 等)使用 loggingframework X,那么您就不会在意它。您需要提供该日志记录框架。但有一个窍门。
Slf4j 提供了一个“替换”其他框架的技巧,假设:
通过这个技巧,您可以将来自不同框架的所有日志语句统一到一个日志框架中,这些框架被实现为使用不同的日志框架。
顺便说一句:你应该知道 Slf4j 本身只是一个 Facade/Bridge,就像公共(public)日志记录一样:- 您可以将日志记录语句转发到您想要的特殊日志记录框架- 或 native 实现 logback
我强烈建议阅读 slf4j manual和 Bridging legacy APIs
是否取决于应用服务器?我只能代表 Tomcat(您提到过):默认情况下,Tomcat 不为您的应用程序提供日志记录框架。
顺便说一句:Tomcat 是一个 Servlet 容器,没有应用程序服务器。
根据 Ehcache Documentation (当谷歌搜索“Ehcache logging”时首次命中),它使用 slf4j。
关于Java 日志记录说明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17934873/
我正在查看预先重写的 jQuery 代码。我无法理解以下代码。 $('body > *:not(#print-modal):not(script)').clone(); 最佳答案 此选择器匹配以下任何
所以我开始学习MySQL,我对表有点困惑,所以我想澄清一下。数据库中可以有多个表吗?例如: Database1 -Table1 -Username -Password -Table2 -Name
我在 PostgreSQL 中编写了一个函数,其代码如下: for (i = 0; i str[0][i]); values[i] = datumCopy(dat_value,
oid: 行的对象标识符(对象 ID)。这个字段只有在创建表的时候使用了 WITH OIDS ,或者是设置了default_with_oids 配置参数时出现。 这个字段的类型是 oid (和字段同
我在搜索最大连接设备数时发现了 a post大致说: 当使用 P2P_STAR 时,最大设备数量为 10,因为此 topoly 使用 Wi-Fi 热点。也就是说,如果您没有路由器。 这让我问了两个问题
我不明白为什么会这样: Printf.sprintf "%08s" "s" = Printf.sprintf "%8s" "s" - : bool = true 换句话说,我希望: Printf.sp
我正在遵循 Grails in Action 中的示例。我有一个问题,如何理解 addTo*()功能有效。 我有一个简单的域:具有以下关系的用户、帖子、标签: 用户1对M发帖 用户一对一标签 发布 M
请问为什么行 "b[0]= new Child2();"在运行时而不是在编译时失败。请不要检查语法,我只是在这里做了 class Base {} class Child1 : Base {} clas
所以我想进一步加深我对套接字的理解,但是我想首先从最低级别开始(在C语言中,而不是在汇编中大声笑) 但是,我处理的大多数站点都使用SOCK_STREAM或SOCK_DGRAM。但是我已经阅读了Beej
好吧,我对 javascript 语法了解甚少,而且我对 null 的行为感到非常困惑。关于空值有很多讨论,但我似乎无法找出问题所在!请帮我。这是脚本。 var jsonData = '';
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭5 年前。 Improve thi
问题: SeriesSum 类旨在计算以下系列的总和: 类名:SeriesSum 数据成员/实例变量: x:存储整数 n:存储术语数量 sum:用于存储系列总和的双变量 成员函数: SeriesSum
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 9 年前。 Improve this ques
今天我在 logcat 中注意到以下内容: D/OpenGLRenderer:0xa2c70600 (CardView) 上的 endAllStagingAnimators,句柄为 0xa2c9d35
如何创建值有序对的列表,例如list1 [(x, y), (x1, y1) ...].?? 学习如何创建此列表后,我需要知道如何将 x 值提供给列表中的用户输入并搜索 x 的下一个值并显示有序对 (x
我在存储过程中有以下逻辑。 这里完成了什么? 如果color为null,替换为'' IF ISNULL(@color, '') <> '' BEGIN END 最佳答案 它等同于: IF (@colo
我知道.Net中的接口(interface)定义了接口(interface)和继承它的类之间的契约。刚刚完成了一个大量使用数据访问层接口(interface)的项目,这让我开始思考。 . .有什么大不
如何防止基类方法被子类覆盖 最佳答案 您不需要做任何特别的事情:默认情况下方法是不可覆盖的。相反,如果您希望该方法可重写,则必须将 virtual 关键字添加到其声明中。 但是请注意,即使方法不可重写
我已阅读以下有关工厂模式的文章 here 请仅引用Class Registration - avoiding reflection这一部分。 这个版本在没有反射的情况下实现了工厂和具体产品之间的减少耦
我正在学习 Java 类(class),但无法完全理解下一课的内容。 目的:本课的目的是通过创建一个模拟 for-each 循环如何工作的替代方案来解释 for-each 循环的工作方式。 在上一课中
我是一名优秀的程序员,十分优秀!