Hibernate4.1.8搭建日志环境

hibernate4.1.8使用JBoss Logging

什么是slf4j?
slf4j是Simple Logging Facade for Java的简称。

以下这段是Hibernate4.1.8官方文档中关于日志的:

Simple Logging Facade for Java (SLF4J) in order to log various system events. 
SLF4J can direct your logging output to several logging frameworks 
(NOP, Simple, log4j version 1.2, JDK 1.4 logging, JCL or logback) depending on your chosen binding.
 In order to setup logging you will need slf4j-api.jar in your classpath together with the jar file for your preferred binding 
- slf4j-log4j12.jar in the case of Log4J. See the SLF4J documentation for more detail.
 To use Log4j you will also need to place a log4j.properties file in your classpath. 
An example properties file is distributed with Hibernate in the src/ directory.

以上这段话大概的意思是: 什么是sjf4j,以及依赖的jar及配置

slf4j与log4j的关系:slf4j像是一个大管家,可以管理许多的日志框架,log4j是其中之一

a) 首先加入slf4j的jar包,slf4j-api-1.7.1.jar, 这个里面全中接口。

b) 加入log4j-1.2.17.jar,即slf4j的log4j实现。

c) slf4j怎么将日志转成log4j? 加入slf4j-log4j12-1.7.1.jar 转换包

c) 从hibernate/project/etc 目录 copy log4j.properties配置文件

d) 査询hibernate文裆,配置其输出策略,主要是两个属性: show_sql、format_sql 


  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值