Bug #84050 SSL warning spams logs
Submitted: 4 Dec 2016 21:49 Modified: 6 Dec 2016 10:18
Reporter: Matty Southall Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.40 OS:Any
Assigned to: CPU Architecture:Any

[4 Dec 2016 21:49] Matty Southall
Description:
The SSL warning for MySQL server versions 5.7+ spams the logs with the SSL warning. This issue occurs specifically where MySQL is used on a servlet container where you may use the JDBC connection in thousands of files.

I understand you can change the JDBC url to "useSSL=false" but this is not ideal when you already have referenced the connection string in thousands of files. The log files constantly get spammed.

File: MySQLIO.java
Line: 1179
Code: "this.connection.getLog().logWarn(Messages.getString("MysqlIO.SSLWarning"));"

How to repeat:
N/A

Suggested fix:
Make it so when the warning is shown once, it is not shown again ever until the application is restarted (the jvm is restarted).
[5 Dec 2016 9:49] Alexander Soklakov
Hi Matty,

The warning happens only when you establish a new connection. And it's there to inform users about the way they should configure the driver to follow MySQL recommendations. Driver doesn't track how it's used in a JVM scope, it may be used to connect to different servers with different security configurations, connections may be reused in many ways, so there is no proper way and proper place to store the connection history you are asking for.

The best way is just follow recommendations and configure driver properly. That's up to developer how the connection string is kept, for example you might consider to create a common conf file pointed by "useConfigs" c/J property.
[5 Dec 2016 11:48] Matty Southall
Hi Alexander,

Thanks for your comment. This does make perfect sense actually. Another solution would be to switch the logging off for MySQL in the servlet container. I have noticed MySQL is using its own logging implementation and not JDK logging library or SLF4J logging. Is there an easy way to make it use JDK logging so it can be configured?
[6 Dec 2016 9:50] Alexander Soklakov
Hi Matty,

You can replace default c/J logger by pointing to your own class via "logger" connection option, see http://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties... for details.