Jump to content
We've recently updated our Privacy Statement, available here ×

Is it possible to log generated SQL in Jasper Studio?


jasperreportsuser
Go to solution Solved by kkumlien,

Recommended Posts

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

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 "log4j.logger.net.sf.jasperreports.engine.query.JRJdbcQueryExecuter=debug" to your JSS jasperreports.properties file, check this thread http://community.jaspersoft.com/questions/526007/logging-sql-query-executed

Link to comment
Share on other sites

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 jasperreports.properties and it doesn't appear to be present. Any further suggestions?
Link to comment
Share on other sites

Actually since that logger is in JasperReports it will be the same for JSS or JasperServer.

To change the jasperreports.properties 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 log4j.logger.net.sf.jasperreports.engine.query.JRJdbcQueryExecuter=debug

 

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 http://community.jaspersoft.com/wiki/configuring-apache-commons-logging-and-log4j-jaspersoft-studio

 

Link to comment
Share on other sites

  • 2 years later...
  • 8 months later...
  • Solution

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

net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.level = FINE[/code]

and comment out the default level for the

FileHandler

:

# java.util.logging.FileHandler.level = INFO[/code]

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...