本文介绍了查看Jasper报告执行的SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行在报表文件(.jrxml)中嵌入SQL的Jasper报表时,是否可以看到执行的SQL?理想情况下,我还希望看到替换每个$ P {}占位符的值。

When running a Jasper report in which the SQL is embedded in the report file (.jrxml), is it possible to see the SQL that is executed? Ideally, I'd also like to see the values that are substituted for each of the $P{} placeholders.

干杯,

Don

推荐答案

JasperReports使用Jakarta Commons Logging API。
Commons Logging有一个发现机制,可以连接到项目中使用的日志API。

JasperReports uses the Jakarta Commons Logging API.Commons Logging has a discovery mechanism that connects to logging API you are using in your project.

您需要在日志记录配置文件中配置名为net.sf.jasperreports的记录器,以控制JasperReports的日志记录级别。

You need to configure logger named "net.sf.jasperreports" in your logging configuration file to control the logging level of JasperReports.

如果你使用的是Log4j,你可以阅读有关于确切细节的文档。

If you are using Log4j, you can read this section of there documentation for exact details.

例如,你可以在log4j.properties文件中写这样的东西

For example you may write something like this in log4j.properties file

log4j.logger.net.sf .jasperreports = INFO,每日

log4j.logger.net.sf.jasperreports=INFO, Daily

其中每日是在同一属性文件中配置的appender的名称。

Where "Daily" is name of an appender configured in same properties file.

这篇关于查看Jasper报告执行的SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 04:54