1 5 package org.apache.ojb.p6spy; 6 7 import com.p6spy.engine.logging.appender.P6Logger; 8 import com.p6spy.engine.logging.appender.FileLogger; 9 10 11 import org.apache.ojb.broker.util.logging.Logger; 12 import org.apache.ojb.broker.util.logging.LoggerFactory; 13 14 20 public class CountLogger extends FileLogger implements P6Logger 21 { 22 protected String lastEntry; 23 private final Logger logger = LoggerFactory.getLogger(this.getClass()); 24 25 private static int countSQL; 26 27 public CountLogger() 28 { 29 logger.debug("start logging"); 30 } 31 32 37 public void logSQL(int i, String s, long l, String s1, String s2, String s3) 38 { 39 if (s1.equals("resultset")) 40 { 41 return; 44 } 45 46 super.logSQL(i, s, l, s1, s2, s3); 47 countSQL++; 48 logger.info("sql: " + s1 + "|" + s3); 49 } 50 51 54 public static int getSQLStatementCount() 55 { 56 return countSQL; 57 } 58 } 59 | Popular Tags |