p6spy agent

一、The p6spy agent can print SQL time, See http://www.p6spy.com
二、 p6spy can join with Log4j
三、 To install P6Spy, complete the following steps:

  • 1、Download and Extract the p6spy-install.jar file. The p6spy-install.jar file contains p6spy.jar and spy.properties.
  • 2、Move the p6spy.jar file add to build path.
  • 3、Move the spy.properties file to classpath.
  • 4、Modify the spy.properties file.
  • 5、Modify the orm.xml file set dataSource's driverClassName="com.p6spy.engine.spy.P6SpyDriver".

An example of a modified realdriver line follows:
# oracle driver 
realdriver = oracle.jdbc.driver.OracleDriver 

#specifies the appender to use for logging 
appender=com.p6spy.engine.logging.appender.Log4jLogger   #default turn off 
#appender=com.p6spy.engine.logging.appender.StdoutLogger 
#appender=com.p6spy.engine.logging.appender.FileLogger   #default turn on 

#The following are for log4j logging only 
log4j.appender.file=org.apache.log4j.FileAppender 
log4j.appender.file.layout=org.apache.log4j.PatternLayout 
log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss} %t - %m%n 
log4j.appender.file.file=${catalina.home}/home/logs/p6spy.log 

log4j.logger.p6spy=INFO,file   #default =INFO,STDOUT 

你可能感兴趣的:(apache,oracle,sql,log4j,jdbc)