Quantcast
Channel: MySQL Forums - Connector/J, JDBC and Java
Viewing all articles
Browse latest Browse all 884

Client side logging (no replies)

$
0
0
I'm running MySQL 5.7 and JDK 1.7

I am trying to log SQL on the client-side of the JDBC connection with the bound parameters ? replaced with actual values.

props = new java.util.Properties();
props.setProperty("logger","com.mysql.jdbc.log.StandardLogger");
props.setProperty("profileSQL", "true");

conn = DriverManager.getConnection("jdbc:mysql://localhost/blahblah?****",
props);

but I am getting the following exception at runtime. The queries run fine when I pass an empty Properties object.

java.lang.Throwable
at com.mysql.jdbc.log.LogUtils.expandProfilerEventIfNecessary(LogUtils.java:47)
at com.mysql.jdbc.log.StandardLogger.logInternal(StandardLogger.java:287)
at com.mysql.jdbc.log.StandardLogger.logInfo(StandardLogger.java:190)
at com.mysql.jdbc.profiler.LoggingProfilerEventHandler.consumeEvent(LoggingProfilerEventHandler.java:45)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2697)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2526)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2484)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1446)
at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3828)
at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3268)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2278)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)

Do I have configuration missing or dependency JARs that I don't know about ?

Viewing all articles
Browse latest Browse all 884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>