This is exactly what I needed. I didn't realize that jooq had other loggers than tools.LoggerListener.
On Sun, Aug 4, 2019 at 4:23 AM Knut Wannheden <[email protected]> wrote: > > > On Sat, Aug 3, 2019 at 10:06 PM Manuel Rossetti <[email protected]> > 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 > > On Friday, August 2, 2019 at 8:23:18 AM UTC-5, Knut Wannheden wrote: >>> >>> 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 >>> >>> On Wed, Jul 31, 2019 at 5:25 PM Manuel Rossetti <[email protected]> >>> wrote: >>> >>>> 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 >>>> >>>> On Wednesday, July 31, 2019 at 12:28:03 AM UTC-5, Knut Wannheden wrote: >>>>> >>>>> 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 >>>>> >>>>> >>>>> On Tue, Jul 30, 2019 at 10:05 PM Manuel Rossetti <[email protected]> >>>>> wrote: >>>>> >>>>>> 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 >>>>>> >>>>>> -- >>>>>> 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 [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/jooq-user/3ff5216e-549d-418a-a7cf-46ca45fcdb36%40googlegroups.com >>>>>> <https://groups.google.com/d/msgid/jooq-user/3ff5216e-549d-418a-a7cf-46ca45fcdb36%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>> 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 [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/jooq-user/c41b0459-b648-4652-a3f4-3e127e68184c%40googlegroups.com >>>> <https://groups.google.com/d/msgid/jooq-user/c41b0459-b648-4652-a3f4-3e127e68184c%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jooq-user/26c17af5-0ba8-4f30-98e3-4ec4c732ea5b%40googlegroups.com >> <https://groups.google.com/d/msgid/jooq-user/26c17af5-0ba8-4f30-98e3-4ec4c732ea5b%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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 > [email protected]. > 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 > <https://groups.google.com/d/msgid/jooq-user/CAFx%3DKge1gPp4Fw9SX-eLgDSNsG9wr%3De39k6EOhW_ps6V-%3DS36g%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAMbxvHmiZQbKXef8tegO2iCO05d-e%3DgtGyxWAe9b9V_%2B-OtzQg%40mail.gmail.com.
