[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/jdbc JDBCPool.java,1.3,1.4
Brought to you by:
bigman921
|
From: Marc B. <big...@us...> - 2004-08-30 00:56:28
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/jdbc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12162/src/net/sourceforge/idrs/jdbc Modified Files: JDBCPool.java Log Message: Added log4j support. cleaned up the logs Index: JDBCPool.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/jdbc/JDBCPool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JDBCPool.java 29 Aug 2004 05:01:41 -0000 1.3 --- JDBCPool.java 30 Aug 2004 00:56:11 -0000 1.4 *************** *** 19,22 **** --- 19,25 ---- import java.util.*; import java.io.*; + + import org.apache.log4j.Logger; + import net.sourceforge.idrs.utils.pool.*; //import JDBCInfo; *************** *** 26,30 **** */ public class JDBCPool extends ObjectPool { ! protected JDBCInfo info; /*removed Marc Boorshtein - 8/31/00 --- 29,33 ---- */ public class JDBCPool extends ObjectPool { ! static org.apache.log4j.Logger logger = Logger.getLogger(JDBCPool.class.getName()); protected JDBCInfo info; /*removed Marc Boorshtein - 8/31/00 *************** *** 69,86 **** protected void logHeader() throws Exception { ! if (this.info == null) { ! System.out.println("No INFO!"); ! } ! if (out == null) ! out = System.out; ! out.println("Starting Poolman, IDRS Version"); ! out.println("dbDriver = " + this.info.getDrivername()); ! out.println("dbServer = " + this.info.getUrl()); ! out.println("dbLogin = " + this.info.getUsername()); ! out.println("log file = " + logPath); ! out.println("minconnections = " + Integer.toString(minn)); ! out.println("maxconnections = " + Integer.toString(limit)); ! out.println("Total refresh intervel = " + Long.toString(daysOpen) + " days"); ! out.println("-----------------------------------------"); } --- 72,85 ---- protected void logHeader() throws Exception { ! ! logger.info("Starting Poolman, IDRS Version"); ! logger.info("dbDriver = " + this.info.getDrivername()); ! logger.info("dbServer = " + this.info.getUrl()); ! logger.info("dbLogin = " + this.info.getUsername()); ! logger.info("log file = " + logPath); ! logger.info("minconnections = " + Integer.toString(minn)); ! logger.info("maxconnections = " + Integer.toString(limit)); ! logger.info("Total refresh intervel = " + Long.toString(daysOpen) + " days"); ! } *************** *** 122,126 **** java.util.Date now = new java.util.Date(System.currentTimeMillis()); ! out.println(now.toString() + " Opening connection " + count + " " + con.toString()); /* OLD CODE Class.forName(info.getDrivername()).newInstance(); --- 121,125 ---- java.util.Date now = new java.util.Date(System.currentTimeMillis()); ! logger.info(now.toString() + " Opening connection " + count + " " + con.toString()); /* OLD CODE Class.forName(info.getDrivername()).newInstance(); *************** *** 138,143 **** } catch (ClassNotFoundException cnfex) { ! out.println("Looks like the driver was not found..."); ! out.println("Be sure it is in your CLASSPATH and listed properly in the properties file."); } catch (SQLException sqlex) { --- 137,142 ---- } catch (ClassNotFoundException cnfex) { ! logger.error("Looks like the driver was not found..."); ! logger.error("Be sure it is in your CLASSPATH and listed properly in the properties file."); } catch (SQLException sqlex) { *************** *** 146,161 **** info.getUrl() + ". Please check your username, password " + "and other connectivity info.");*/ ! out.println(sqlex); } catch(RuntimeException e) { ! out.println(e); //e.printStackTrace(); } catch(Exception e) { ! out.println(e); //e.printStackTrace(); } catch(Throwable t) { ! out.println(t); //t.printStackTrace(); } --- 145,160 ---- info.getUrl() + ". Please check your username, password " + "and other connectivity info.");*/ ! logger.error("Could not load driver",sqlex); } catch(RuntimeException e) { ! logger.error("Could not load driver",e); //e.printStackTrace(); } catch(Exception e) { ! logger.error("Could not load driver",e); //e.printStackTrace(); } catch(Throwable t) { ! logger.error("Could not load driver",t); //t.printStackTrace(); } *************** *** 179,183 **** return ((conn != null) && (! conn.isClosed())); } catch(SQLException e) { ! out.println(e); } return false; --- 178,182 ---- return ((conn != null) && (! conn.isClosed())); } catch(SQLException e) { ! logger.error("Could not validate connection",e); } return false; *************** *** 204,208 **** } catch (Exception e) { ! out.println(e); } } --- 203,207 ---- } catch (Exception e) { ! logger.error("Could not expire connection",e); } } *************** *** 218,224 **** throw new SQLException(sqle.getMessage()); } catch(Exception e) { ! out.print("A non-SQL error occurred when requesting a connection:"); ! out.println(e); ! e.printStackTrace(out); //e.printStackTrace(); } --- 217,222 ---- throw new SQLException(sqle.getMessage()); } catch(Exception e) { ! logger.error("A non-SQL error occurred when requesting a connection:",e); ! //e.printStackTrace(); } *************** *** 320,324 **** expire(pool[index]); pool[index] = null; ! out.println("----->Resetting connection " + index + " ..."); int tmpCount = count; count = index; --- 318,322 ---- expire(pool[index]); pool[index] = null; ! logger.debug("----->Resetting connection " + index + " ..."); int tmpCount = count; count = index; *************** *** 327,331 **** } catch (Exception e) { ! out.println(e); } } --- 325,329 ---- } catch (Exception e) { ! logger.error("Could not reset connection",e); } } |