hibernate 配置log4j

2025-11-28 21:18:23

1、在已经下载好hibernate-distribution-3.3.2.GA.jar,slf4j-1.5.8.jar两个jar包的前提下,下载apache-log4j-1.2.17.jar

hibernate 配置log4j

hibernate 配置log4j

hibernate 配置log4j

2、打开myEcpllise/ecplise,新建一个java project,命名为AProjectForHibernate

hibernate 配置log4j

3、选中项目,点击右键,选择build path,点击add libernary

hibernate 配置log4j

4、增加hibernate需要的jar包(此处加载的是annotation注解方式所需要的)

hibernate 配置log4j

hibernate 配置log4j

hibernate 配置log4j

hibernate 配置log4j

5、增加【log4j-1.2.17.jar】,【slf4j-log4j12-1.5.8.jar】

hibernate 配置log4j

hibernate 配置log4j

6、在程序根目录中增加log4j.properties,可从【hibernate-distribution-3.3.2.GA\project\etc】中拷贝

hibernate 配置log4j

7、将log4j.properties中一些暂时不需要的注释掉

hibernate 配置log4j

8、总共的jar包需要12个(不包括数据库连接所使用的)

hibernate 配置log4j

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢