休眠抑制信息消息 [英] Hibernate suppress info messages

查看:103
本文介绍了休眠抑制信息消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我对Java不太熟悉,我正在用Hibernate创建一个简单的测试项目,但是在控制台上却收到了很多我想压制的INFO消息.我正在Eclipse中创建Java SE程序.

So I am not very experience in Java and I am creating a simple test project with Hibernate but I am gettinga lot of INFO messages on the console that I want to suppress. I am creating a Java SE program in Eclipse.

现在,据我所知,我需要在log4j.properties文件中对其进行控制,并且似乎已经找到了要使用的适当配置,但问题在于它似乎没有什么区别!

Now as I think I understand it then I need to control this in a log4j.properties file, and I seem to have found the appropiate config to use, but the problem is that it appears that it makes no difference!

我的猜测是我的log4j.properties文件没有被读取.但是我发现所有的详细信息都放在了src目录的根目录中,但这似乎没有任何区别.而且我尝试将其放置在类路径中的其他位置,但都没有运气.

My guess is that my log4j.properties file is somehow not being read. But all the details I have found say to place in in the root of my src directory, but it appears not to make any difference. And I have tried placing it in other places in my classpath but all with no luck.

有人可以帮我找出问题并解决吗?

Can somebody help me track down the issue and resolve this?

上周我在使用JMS时使用jndi.properties文件遇到了类似的问题.我最终解决了我猜我总体上做错了事.因此,有关在何处放置config/properties文件的任何提示将不胜感激.

I had a similar issue last week with a jndi.properties files while using JMS. I eventually resolved that by I am guessing that I am doing something wrong in general. So any tips would be appreciated on where to place config/properties files.

谢谢.

推荐答案

log4j日志记录层次结构顺序

log4j logging hierarchy order

关闭
致命
错误
警告
信息
调试
追踪
全部

OFF
FATAL
ERROR
WARN
INFO
DEBUG
TRACE
ALL

要禁止显示信息消息,您需要将log4j.properties设置为

To suppress info messages ,you need to make log4j.properties as

#rootlogger specs
log4j.rootLogger=ERROR, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

将其他任何记录器设置为关闭"

set any other logger as OFF

这篇关于休眠抑制信息消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆