How to enable logging in mysql-connector-java-5.1.36
Posted by: subramanian santhanam
Date: September 18, 2015 07:01AM


I am using preparedstatement and execute them as batches from Java windows application. I want to log all the db activities.

I used the following syntax while opening the connection
DB_URL = "jdbc:mysql://localhost/test?logger=com.mysql.jdbc.log.StandardLogger&profileSQL=true"

and my log4j property file is like this,
# Root logger option
log4j.rootLogger=TRACE, rfile, rfile
log4j.appender.rfile = org.apache.log4j.RollingFileAppender
log4j.appender.rfile.File =PrepStmt.log
log4j.appender.rfile.MaxFileSize = 100KB
log4j.appender.rfile.Append = true
log4j.appender.rfile.layout = org.apache.log4j.PatternLayout
log4j.appender.rfile.layout.ConversionPattern= %d [%t] %-5p %c %x - %m%n

Nothing is getting appended to my logs. Where am I going wrong, kindly guide me.

Subramanian S.

Options: ReplyQuote

Written By
How to enable logging in mysql-connector-java-5.1.36
September 18, 2015 07:01AM

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.