是否可以使用 EclipseLink 输出生成的 SQL 而不必增加日志详细程度? [英] Is it possible to output generated SQL using EclipseLink without having to increase log verbosity?
问题描述
我想在开发过程中将 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
:
<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 或 log4jdbc-remix.
An alternative is using log4jdbc or log4jdbc-remix.
这篇关于是否可以使用 EclipseLink 输出生成的 SQL 而不必增加日志详细程度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!