1. download it from http://code.google.com/p/log4jdbc/
log4jdbc4-1.2beta2.jar: for JDBC 4 (JDK 1.6 and 1.7) Featured Jun 2010 62.2 KB 4647
log4jdbc3-1.2beta2.jar: for JDBC 3 (JDK 1.4 and 1.5) Featured Jun 2010 50.4 KB 2146
I uses log4jdbc4-1.2beta2.jar donwload it ot desktop.
2. add to your maven server:
http://localhost:8081/nexus/index.html#view-repositories log in as admin/admin123
click Repositories on the left menu.
then 3rd party --> then on the bottom right panel click "Artifact Upload":
GAV Definition: GAV Parameters.
Group: net.sf.log4jdbc
Artifact: log4jdbc4
version: 1.2beta2
Packaging: jar
Then click "Select Artifacct(s) to Upload... to find the jar file.
Click "Add Artifact" button
click "Upload Artifact(s)
The artifact is stored in the nexus now. to verify it: click "Brownse Storage" --> Refresh --> net.sf..... you find it.,
3. to use it in your project:
3.1 add the pom to your pom file:
<dependency>
<groupId>net.sf.log4jdbc</groupId>
<artifactId>log4jdbc4</artifactId>
<version>1.2beta2</version>
</dependency>
3.2 suppose that you have setup slf4j log system already.
3.3 Set your JDBC driver class to
net.sf.log4jdbc.DriverSpy
in your application's configuration
3.4 Prepend log4jdbc to the normal jdbc url that you are using.
For example, if your normal jdbc url is
original: jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase
new jdbc:log4jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase
then You would change it to:
jdbc:log4jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase
to use log4jdbc.
Here is the example:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="net.sf.log4jdbc.DriverSpy"/>
<property name="url" value="jdbc:log4jdbc:hsqldb:mem:test"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
Original one:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:mem:test"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
// if you can do it like that, you can wrap it :
final Connection conn = ds().getConnection();
Connection connection = new net.sf.log4jdbc.ConnectionSpy(conn);
分享到:
相关推荐
How to use projector
How to use SFTP (with client validation - public key authentication) The topic How to use SFTP (with client validation - password authentication) discusses the simplest form of client ...
How to Use Objects Code and Concepts Holger Gast
this article introduces how to use awk in linux
How to use the Bayes Net Toolbox? This documentation was last updated on 29 October 2007.
How To Use Adobe Photoshop CS2 <br>Photoshop CS2使用指南 <br>By Daniel Giordan, Doug Nelson <br>Publisher: Sams Publishing <br>Have you ever looked at your color pictures and wished ...
本文将详细介绍如何在Java开发环境中,通过JDBC(Java Database Connectivity)利用REF Cursors执行动态SQL查询。 ### 一、REF Cursors概述 REF Cursors是Oracle数据库中的一种特殊类型,它是指向另一个游标...
How to use epoll A complete example in C How to use epoll A complete example in C How to use epoll A complete example in C How to use epoll A complete example in C
IBM How to use Seven Keys To Success.
In this book, Chris Date explains relational theory in depth, and demonstrates through numerous examples and exercises how you can apply it to your use of SQL. This third edition has been revised, ...
Simple application that shows how to use the Data Control to connect to the Biblio.mdb database and display all authors in the Authors table.
HOW TO USE SDRAM ,sdr sdram的用户手册,比datasheet讲述的详细!
how to use array in jaba
how to use spring validator
How to Use Objects will help you gain that understanding, so you can write code that works exceptionally well in the real world. Author Holger Gast focuses on the concepts that have repeatedly ...
How to use HttpWebRequest and HttpWebResponsein _NET
This tutorial explains how to set up log4j with email, files and stdout. It compares XML to properties configuration files, shows how to change LogLevels for a running application. Furthermore, we ...
How to use 256 Color Bitmaps in ImageList (Win32 SDK solution)如何在ImageList中使用256色的位图(Win32 SDK的解决方案)(5KB)
1- In order to use log4erl, you need to first include it in the path. There are 2 ways to do this: a) include the "log4erl" directory in erlang's "lib" directory in the target machine (cp -Rf log4erl ...