39

I'm a big fan of JooQ, but unfortunately since upgrading from 3.3 it prints a very annoying message to the console each time before my code exits:

Feb 02, 2015 7:28:06 AM org.jooq.tools.JooqLogger info
INFO: 

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
<snip>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  Thank you for using jOOQ 3.5.1

Unfortunately I cannot manage to remove this log at all.

Note that I don't use slf4j, nor log4j nor any log API; therefore the only mechanism I have available is j.u.l.

I have tried to disable it completely using this:

static {
    Stream.of(Logger.getAnonymousLogger(), Logger.getGlobal(),
        Logger.getLogger("org.jooq.tools.JooqLogger")
    ).forEach(l -> {
        l.setLevel(Level.OFF);
        final Handler[] handlers = l.getHandlers();
        Arrays.stream(handlers).forEach(l::removeHandler);
    });
}

Unfortunatley, it doesn't work, the message still appears.

How do I make this message disappear short of modifying the code, which I want to avoid here?

fge
  • 119,121
  • 33
  • 254
  • 329
  • 2
    You can purchase a commercial license ;) On a more serious note. [Does any of this help?](http://stackoverflow.com/questions/2533227/how-can-i-disable-the-default-console-handler-while-using-the-java-logging-api) – Lukas Eder Feb 02 '15 at 15:53

6 Answers6

31

This seems to work for me:

static {
    LogManager.getLogManager().reset();
}

This is also indicated as a solution a couple of times in this Stack Overflow question.

Note that version 3.6+ will also ship with a system property that can be used to deactivate displaying this logo:

-Dorg.jooq.no-logo=true
Community
  • 1
  • 1
Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
27

On v3.6 and higher you can do:

System.setProperty("org.jooq.no-logo", "true");
Gili
  • 86,244
  • 97
  • 390
  • 689
mevdschee
  • 1,625
  • 19
  • 16
9

That message is located in the org.jooq.impl.DefaultRenderContext source file and it is using the org.jooq.Constants logger. Here is the relevant source code:

    /* [trial] */ 
    JooqLogger l = JooqLogger.getLogger(Constants.class); 
    String message;
    message = "Thank you for using jOOQ " + Constants.FULL_VERSION;

    /* [pro] xx 
    xxxxxxx x xxxxxx xxx xxx xxxxx xxx xx xxx xxxx xxxx x x xxxxxxxxxxxxxxxxxxxxxx x x xxxxx xxxxxxxxx 
    xx [/pro] */ 

Looks like the message is generated because you are using a trial version. I would assume that upgrading to the pro version would disable the message. What else could be better way to show that you are a big fan of the project?

Otherwise, if you can live with the guilt and shame, you could disable info messages from the org.jooq.Constants logger by setting the level to WARNING.

This can be done adding the following to your logging.properties:

#ThanksNoThanks
org.jooq.Constants.level=WARNING

Or in Java code by calling the following methods:

//SorryNotSorry
private static final JOOQ_AD_LOGGER = Logger.getLogger("org.jooq.Constants");
static {
   JOOQ_AD_LOGGER.setLevel(Level.WARNING);
}

Make sure you stay in compliance with your jOOQ License and Maintenance Agreement:

jOOQ License and Maintenance Agreement: 
* ----------------------------------------------------------------------------- 
* Data Geekery grants the Customer the non-exclusive, timely limited and 
* non-transferable license to install and use the Software under the terms  of 
* the jOOQ License and Maintenance Agreement. 
* 
* This library is distributed with a LIMITED WARRANTY. See the jOOQ License 
* and Maintenance Agreement for more details: http://www.jooq.org/licensing 
*/ 
jmehrens
  • 10,580
  • 1
  • 38
  • 47
  • 5
    I am a fan, yes, and certainly advertise that I am using it... On the project page. But this is live code and I want to keep the logs clean! – fge Feb 02 '15 at 15:44
  • 3
    *"Make sure you stay in compliance with your jOOQ License and Maintenance Agreement"* - It's perfectly fine as long as this is about the ASL 2.0 licensed jOOQ Open Source Edition, with which you can do anything you want. *"if you can live with the guilt and shame"* - [Well... ;)](http://i.imgur.com/fnm5KAb.jpg) – Lukas Eder Feb 02 '15 at 15:54
  • @LukasEder don't be mistaken, I love it; if you want to know what I use it for, it is for [this project](https://github.com/fge/grappa-debugger) when loading huge trace files (I have one with 44 million trace events...). I use jooq + h2, and I intend to show the jooq logo on the window which shows database status loading ;) – fge Feb 02 '15 at 16:07
  • @fge: Thanks for the update. I wasn't mistaken, and I understand that you want to remove the log. We intended for it to be there "by default" in the free trial and the Open Source Edition, and it should be possible to be muted using `java.util.logging` settings... – Lukas Eder Feb 02 '15 at 16:14
  • @LukasEder it's not short of trying, I just can't do it :( This really pains me, it prevents me from using the log analysis tools I usually use... – fge Feb 02 '15 at 17:23
  • 1
    @fge: [This answer here worked for me right out of the box](http://stackoverflow.com/a/5003248/521799). It had to be called before any jOOQ class is loaded, though. E.g. in a static block of the class where your `main()` is... – Lukas Eder Feb 02 '15 at 17:34
4

In case you are using org.slf4j.Logger for logging, in your resources/logback.xml you may add something like that

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

mcfan
  • 159
  • 3
3

This work for me on JavaFx 8 in main class on Jooq 3.11+

@Override
    public void start(Stage primaryStage) throws Exception{
     System.getProperties().setProperty("org.jooq.no-logo", "true");
     ///Extra code......

}
1

I use slf4j,in my logback-spring.xml, I added:

<logger name="org.jooq.Constants" level="warn">
        <appender-ref ref="STDOUT" />
</logger>

This worked.

Hoppeduppeanut
  • 1,109
  • 6
  • 20
  • 29