Connector J will generate a lot of stacktrace outputs to standard error per query, regardless of whether the query is slow or not.
The main process flow of com.mysql.cj.protocol.a.NativeProtocol.sendQueryPacket()
send query read result set if (this.profileSQL || this.logSlowQueries) { fire QUERY ProfilerEvent logger.logInfo(event) get stack trace by create a Throwable object. System.err.println(messageAsString);//stack trace included in messageAsString }
References:
1. MySQL Connector/J Configuration Properties
2. Connector J with profileSQL – log contains lots of STACKTRACE data
3. Creating an exception in Java is very slow
4. Source code of MySQL Connector/J