unexpected log of delete without where

41 views
Skip to first unread message

Manuel Rossetti

unread,
Jul 30, 2019, 4:05:16 PM7/30/19
to jOOQ User Group
I am in the process of upgrading to Java 11 and going from jooq 3.10.4 to 3.11.11.

I normally log the jooq messages into their own log files using slf4j and logback.

I do have a delete without where clause implemented in my project.  In my pre-java 11 work (java 8 with jooq 3.10.4), I use something like:

getDSLContext().settings().withExecuteLogging(false);

To turn of the logging.  I don't get any delete without were clause in my logs.  The delete from table logging is captured, when I do turn on the logging. 

However, when running under java 11 with 3.11.11, I get log messages to the console like below.  I would like to know where they are coming from and a solution to get them into the normal jooq log flow.

Thanks!

2019-07-29 17:06:47,983 3272 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
2019-07-29 17:06:48,015 3304 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
2019-07-29 17:06:48,020 3309 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
2019-07-29 17:06:48,033 3322 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
2019-07-29 17:06:48,044 3333 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
2019-07-29 17:06:48,063 3352 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause

Knut Wannheden

unread,
Jul 31, 2019, 1:28:03 AM7/31/19
to jooq...@googlegroups.com
Hi Manuel,

Thank you very much for your message.

As of jOOQ 3.11 the Settings object has two new properties "executeUpdateWithoutWhere" and "executeDeleteWithoutWhere" which can be used to control the logging of such statements. They can both be set to one of the values IGNORE, LOG_DEBUG, LOG_INFO, LOG_WARN, or THROW. LOG_DEBUG is the default for both, which explains the log message you are seeing.

Apart from that these messages are not logged any differently from other log messages in jOOQ. So if the logging to the console (stdout?) is unexpected, there could be something wrong with your logging configuration.

I hope this helps. Please let us know if you have any other questions.

Knut


--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/3ff5216e-549d-418a-a7cf-46ca45fcdb36%40googlegroups.com.

Manuel Rossetti

unread,
Jul 31, 2019, 11:25:33 AM7/31/19
to jOOQ User Group
Dear Knut,

Thanks for your quick reply.  I have double checked my logging configuration file. It is exactly the same that I have been using with jooq 3.10.4.  I have attached it. It is pretty standard.

What I find interesting is that when I use withExecuteLogging(true), I do not get the DELETE without WHERE debug messages into my log file.  They only appear via console output.  If I use withExecuteLogging(false), I get nothing in my jooq log file (as expected) but I still get the DELETE without WHERE sent to the console.  It doesn't make sense to me that it should do this.

Are you saying that in 3.11, we have to use BOTH withExecuteLogging() AND the two new properties you mentioned to control logging.  If so, why doesn't the DELETE without WHERE  messages appear in the normal jooq log attached to
org.jooq.tools.LoggerListener?

For example, this appears in my regular jooq log file:

2019-07-31 10:06:16,824 2240 [main] DEBUG org.jooq.tools.LoggerListener - Executing query          : delete from "JSL_DB"."BATCH_STAT"
2019-07-31 10:06:16,845 2261 [main] DEBUG org.jooq.tools.LoggerListener - Executing query          : delete from "JSL_DB"."WITHIN_REP_COUNTER_STAT"
2019-07-31 10:06:16,853 2269 [main] DEBUG org.jooq.tools.LoggerListener - Executing query          : delete from "JSL_DB"."ACROSS_REP_STAT"
2019-07-31 10:06:16,869 2285 [main] DEBUG org.jooq.tools.LoggerListener - Executing query          : delete from "JSL_DB"."WITHIN_REP_STAT"
2019-07-31 10:06:16,881 2297 [main] DEBUG org.jooq.tools.LoggerListener - Executing query          : delete from "JSL_DB"."MODEL_ELEMENT"
2019-07-31 10:06:16,902 2318 [main] DEBUG org.jooq.tools.LoggerListener - Executing query          : delete from "JSL_DB"."SIMULATION_RUN"

But, this ONLY appears on my console:

2019-07-31 10:06:16,812 2228 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
2019-07-31 10:06:16,844 2260 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
2019-07-31 10:06:16,852 2268 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
2019-07-31 10:06:16,869 2285 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
2019-07-31 10:06:16,881 2297 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
2019-07-31 10:06:16,901 2317 [main] DEBUG org.jooq.impl.AbstractQuery - DELETE without WHERE     : A statement is executed without WHERE clause
To unsubscribe from this group and stop receiving emails from it, send an email to jooq...@googlegroups.com.
logback.xml

Knut Wannheden

unread,
Aug 2, 2019, 9:23:18 AM8/2/19
to jooq...@googlegroups.com
Hi Manuel,

Can you maybe show us what your logging configuration looks like? jOOQ logs all its messages through SLF4J (if available, otherwise through java.util.logging). The "A statement is executed without WHERE clause" messages are no exception to that.

I am suspecting that your logging configuration uses a different "appender" for the messages with "LoggerListener" as the source. If you were to use the same "appender" for messages from the "AbstractQuery" logger, I think everything should be fine (together in one place).

Hope this helps,
Knut

To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/c41b0459-b648-4652-a3f4-3e127e68184c%40googlegroups.com.

Manuel Rossetti

unread,
Aug 3, 2019, 4:05:58 PM8/3/19
to jOOQ User Group
I attached my logback.xml file to my previous reply.  I only have one appender for the LoggerListener.

Knut Wannheden

unread,
Aug 4, 2019, 5:23:41 AM8/4/19
to jooq...@googlegroups.com
On Sat, Aug 3, 2019 at 10:06 PM Manuel Rossetti <mdrfo...@gmail.com> wrote:
I attached my logback.xml file to my previous reply.  I only have one appender for the LoggerListener.

I missed that. But this confirms my suspicion. You have only configured the logger org.jooq.tools.LoggerListener to log to the JOOQFILE appender. If you also configure the org.jooq.impl.AbstractQuery logger to log using the JOOQFILE appender, it should work as expected. You can either do that explicitly or you could configure all "org.jooq" loggers use the JOOQFILE appender:

    <logger name="org.jooq" level="DEBUG" additivity="false">
        <appender-ref ref="JOOQFILE" />
    </logger>

But with the DEBUG level you would then possibly get too much logging from jOOQ. In that case you could change the logback configuratoin to something like this:

    <logger name="org.jooq" level="WARN" additivity="false">
        <appender-ref ref="JOOQFILE" />
    </logger>
    <logger name="org.jooq.tools.LoggerListener" level="DEBUG" additivity="false">
        <appender-ref ref="JOOQFILE" />
    </logger>

and in addition also configure the two settings we discussed (assuming you do want them to be logged as a warning):
getDSLContext().settings().withExecuteUpdateWithoutWhere(ExecuteWithoutWhere.LOG_WARN).withExecuteDeleteWithoutWhere(ExecuteWithoutWhere.LOG_WARN);
Hope this helps,
Knut

To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/26c17af5-0ba8-4f30-98e3-4ec4c732ea5b%40googlegroups.com.

Manuel Rossetti

unread,
Aug 16, 2019, 10:29:34 AM8/16/19
to jooq...@googlegroups.com
This is exactly what I needed.  I didn't realize that jooq had other loggers than tools.LoggerListener.

You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/6-ObjzSTvls/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAFx%3DKge1gPp4Fw9SX-eLgDSNsG9wr%3De39k6EOhW_ps6V-%3DS36g%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages