MySQL Forums
Forum List  »  General

Client side logging
Posted by: John Norvell
Date: December 09, 2014 01:44PM

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 ?

Options: ReplyQuote


Subject
Written By
Posted
Client side logging
December 09, 2014 01:44PM
December 09, 2014 03:47PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.