是否可以使用EclipseLink输出生成的SQL,而不必增加日志的详细程度? [英] Is it possible to output generated SQL using EclipseLink without having to increase log verbosity?

查看:233
本文介绍了是否可以使用EclipseLink输出生成的SQL,而不必增加日志的详细程度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在开发过程中将EclipseLink生成的SQL输出到控制台.但是,我只能使用日志记录级别FINE来执行此操作.我有一个由许多类组成的复杂域模型,以至于当日志详细程度处于FINE级别时,部署要花费大量时间,因为EclipseLink输出了对整个模型的分析.

I want to output the SQL generated by EclipseLink to the console, during development. However, I could only do so using the logging level FINE. I have a complex domain model composed of many classes, so much that deployment takes a considerable ammount of time when the log verbosity is on the FINE level, since EclipseLink outputs its analysis of the whole model.

是否有一种无需使用日志级别FINE就能获得SQL的方法(就像Hibernate一样)?

Is there a way to get the SQL without resorting to log level FINE (like Hibernate does)?

推荐答案

在您的persistence.xml中放置以下属性:

Put the following properties in your persistence.xml:

 <property name="eclipselink.logging.level.sql" value="FINE"/>
 <property name="eclipselink.logging.parameters" value="true"/>

后者非常有用,因此可以显示参数的值.

The latter is helpful, so that the values of the parameter are shown.

一种替代方法是使用 log4jdbc

An alternative is using log4jdbc or log4jdbc-remix.

这篇关于是否可以使用EclipseLink输出生成的SQL,而不必增加日志的详细程度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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