Customize rendering while logging executing query

20 views
Skip to first unread message

Marcus Gattinger

unread,
Feb 22, 2018, 6:28:42 AM2/22/18
to jOOQ User Group
Hi,

is there any possibility to customize the format of the logged executing query?

For example assume the following default logging:
Execute query        : select `test`.`table`.`id` from `test`.`table` where `test`.`table`.`fk_sid` = 43

I want to make the logging more concise by omitting the database / schema name:
Execute query        : select `table`.`id` from `table` where `table`.`fk_sid` = 43

Is this possible by means of any render configuration?

Kind regards,
Marcus

Lukas Eder

unread,
Feb 22, 2018, 7:00:27 AM2/22/18
to jooq...@googlegroups.com
Hi Marcus,

The default LoggerListener will log the queries exactly as they are being sent to the JDBC driver (and thus the server). If this request isn't really specific to logging only, then you could turn off the generation of schema names by specifying Settings.renderSchema = false in your Configuration object at runtime [1] [2], or specify <outputSchemaToDefault>true</outputSchemaToDefault> in your code generation configuration [3]

If, however, you'd like to keep the actual SQL as it is and just generate different log output, then turn off Settings.executeLogging = false [4] and implement your own ExecuteListener [5]. You could take inspiration from the jOOQ LoggerListener

Hope this helps,
Lukas


--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marcus Gattinger

unread,
Feb 22, 2018, 8:44:50 AM2/22/18
to jOOQ User Group
Hi, Lukas,

thanks for your quick reply and yes this helps. I already use a derived implementation of jOOQ's LoggerListener. I know that I'm free to override the renderEnd() method to reflect my needs but using setRenderSchema(false) will do the job, too.

Regards,
Marcus
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages