Log4jdbc is a Java JDBC driver that can log SQL and/or jdbc cils (and optionally SQL timing informa

Source: Internet
Author: User

Log4jdbcIs a Java JDBC driver that can log SQL and/or jdbc cils (and optionally SQL timing
Information) for other JDBC drivers


The official homepage is code.google.com/p/log4jdbc/


A log tool that prints SQL statements based on slf4j.The latest version is 1.2 final.

 

 

 

It mainly describes usage:

 

1. Select the version, mainly jdbc3 and jdbc4. Now we use jdbc4 to add the jar package to classpath.

2. Select the log system. Of course, slf4j + logback is the first

3. Modify the jdbc url. For a small modification, refer to the official documentation.

Take MYSQL as an example:

Original Configuration:

# JDBC. driverclassname = com. MySQL. JDBC. Driver
# JDBC. url = JDBC: mysql: // localhost: 3306/DTU? Useunicode = true & characterencoding = UTF-8

Current Configuration:
JDBC. driverclassname =Net. SF. log4jdbc. driverspy
JDBC. url = JDBC:LOg4jdbc:MySQL: // localhost: 3306/DTU? Useunicode = true & characterencoding = UTF-8

The user name and password remain unchanged
JDBC. Username = xxx
JDBC. Password = xxx

4. Add the log configuration. It seems JDBC. sqltiming is the most useful, and SQL + execution time

 

Enjoy it

Update

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.