Is it possible to log generated SQL in Jasper Studio?

I've seen some discussion on how to log generated SQL on jasper server and iReport.  Is it possible to do so in Jaspersoft Studio?

jasperreportsuser's picture
Joined: Apr 3 2014 - 10:46am
Last seen: 7 years 10 months ago

2 Answers:

Java Util Logging (but not Log4j) should work as per Configuring Apache Commons Logging and Log4J in Jaspersoft Studio if you set this in

net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.level = FINE

and comment out the default level for the FileHandler:

# java.util.logging.FileHandler.level = INFO

Also make sure java.util.logging.FileHandler.pattern

and -Dorg.apache.commons.logging.diagnostics.dest point to different files. The file set in java.util.logging.FileHandler.pattern should contain your SQL statements.

kkumlien's picture
Joined: Jan 22 2015 - 4:36am
Last seen: 6 months 4 weeks ago

Good question.. normaly in JSS you write the query so it's pretty straight forward, what you write is sent to the DB, the only case you may find that useful is with marameter subtitution (if your query is using $P{} or $X{}) in that case you can use the JR query logging. 

To do this add "" to your JSS file, check this thread

marianol's picture
Joined: Sep 13 2011 - 8:04am
Last seen: 4 years 11 months ago

Thank you for the reply. You are exactly right about the reasoning. I am trying to dig deeper into what is going on in my report and want to see what SQL results from my $X expressions. I believe your link is again referring to the Jasper Server. As I do not administrate the Jasper server I would like to view the SQL generated in Jaspersoft Studio. I searched the install folder for and it doesn't appear to be present. Any further suggestions?

jasperreportsuser - 9 years 2 months ago

Actually since that logger is in JasperReports it will be the same for JSS or JasperServer.
To change the file in JasperSoft Studio you have a UI to get there go to:
MyReports -> Properties -> Jaspersoft Studio group -> Properties -> Use Workspace Settings -> Configure Workspace Settings
and then you can add your

But now that I look into it the log4J does not look like is configured by default in JSS so here is the info to configure it

marianol - 9 years 2 months ago

I tried the configuration as defined and added as mentioned above however it still does not work. Can I get some help.

kaushik_3 - 6 years 11 months ago