From: bruce m. <tr...@us...> - 2004-07-24 00:19:03
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26389/modules/sql/src/com/babeldoc/sql/pipeline/stage Modified Files: SqlEnrichPipelineStage.java SqlQueryPipelineStage.java SqlWriterPipelineStage.java Log Message: Logging cleanups... 1. Created log instance variable instead of calling LogService.getInstance(). 2. All logs to debug check if debug level is set. Index: SqlWriterPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage/SqlWriterPipelineStage.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** SqlWriterPipelineStage.java 15 Aug 2003 00:25:30 -0000 1.15 --- SqlWriterPipelineStage.java 24 Jul 2004 00:18:54 -0000 1.16 *************** *** 109,112 **** --- 109,115 ---- private boolean batchSupported = false; private int batchSize = 20; + + /** logging instance */ + private LogService log = LogService.getInstance(this.getClass().getName()); /** *************** *** 243,253 **** //excute statement String command = br.readLine(); ! LogService.getInstance().logDebug("Current line= " + command); if (command == null) { if (batchSupported && (currentBatchSize > 0)) { stmt.executeBatch(); ! LogService.getInstance().logDebug("Executed " + currentBatchSize + ! " statements in batch"); } --- 246,258 ---- //excute statement String command = br.readLine(); ! if(log.isDebugEnabled()) ! log.logDebug("Current line= " + command); if (command == null) { if (batchSupported && (currentBatchSize > 0)) { stmt.executeBatch(); ! if(log.isDebugEnabled()) ! log.logDebug("Executed " + currentBatchSize + ! " statements in batch"); } *************** *** 284,299 **** if (batchSupported) { stmt.addBatch(command); ! LogService.getInstance().logDebug("LightConfigCommand " + command + ! " added to batch list"); currentBatchSize++; if (currentBatchSize == batchSize) { stmt.executeBatch(); ! LogService.getInstance().logDebug("Executed " + ! currentBatchSize + " statements in batch"); } } else { ! LogService.getInstance().logDebug("Executing statement: " + ! command); stmt.execute(command); } --- 289,306 ---- if (batchSupported) { stmt.addBatch(command); ! if(log.isDebugEnabled()) ! log.logDebug("LightConfigCommand " + command + ! " added to batch list"); currentBatchSize++; if (currentBatchSize == batchSize) { stmt.executeBatch(); ! if(log.isDebugEnabled()) ! log.logDebug("Executed " + ! currentBatchSize + " statements in batch"); } } else { ! if(log.isDebugEnabled()) ! log.logDebug("Executing statement: " + command); stmt.execute(command); } *************** *** 313,317 **** } ! LogService.getInstance().logWarn(I18n.get("sql.196", currentMessage)); if (failOnFirst) { --- 320,324 ---- } ! log.logWarn(I18n.get("sql.196", currentMessage)); if (failOnFirst) { *************** *** 332,336 **** if (shouldCommit) { conn.commit(); ! LogService.getInstance().logDebug("committed"); } else { conn.rollback(); --- 339,344 ---- if (shouldCommit) { conn.commit(); ! if(log.isDebugEnabled()) ! log.logDebug("committed"); } else { conn.rollback(); *************** *** 342,346 **** return shouldCommit; } catch (SQLException ex) { ! LogService.getInstance().logError(I18n.get("sql.197"), ex); throw new PipelineException(I18n.get("sql.198"), ex); } finally { --- 350,354 ---- return shouldCommit; } catch (SQLException ex) { ! log.logError(I18n.get("sql.197"), ex); throw new PipelineException(I18n.get("sql.198"), ex); } finally { Index: SqlQueryPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage/SqlQueryPipelineStage.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SqlQueryPipelineStage.java 23 Oct 2003 00:20:05 -0000 1.6 --- SqlQueryPipelineStage.java 24 Jul 2004 00:18:54 -0000 1.7 *************** *** 198,202 **** sql = queries[i].getValue(); stmt = conn.createStatement(); ! LogService.getInstance().logDebug("Executing " + sql); rs = stmt.executeQuery(sql); handleRows(rs, queryElement); --- 198,203 ---- sql = queries[i].getValue(); stmt = conn.createStatement(); ! if(LogService.getInstance().isDebugEnabled()) ! LogService.getInstance().logDebug("Executing " + sql); rs = stmt.executeQuery(sql); handleRows(rs, queryElement); Index: SqlEnrichPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage/SqlEnrichPipelineStage.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SqlEnrichPipelineStage.java 15 Aug 2003 21:19:57 -0000 1.16 --- SqlEnrichPipelineStage.java 24 Jul 2004 00:18:54 -0000 1.17 *************** *** 110,113 **** --- 110,116 ---- //Connection pool private IResource resource = null; + + /** logging instance */ + private LogService log = LogService.getInstance(this.getClass().getName()); /** *************** *** 168,172 **** conn = getConnection(); stmt = conn.createStatement(); ! LogService.getInstance().logDebug("Executing statement: " + sqlStatement); rs = stmt.executeQuery(sqlStatement); --- 171,176 ---- conn = getConnection(); stmt = conn.createStatement(); ! if(log.isDebugEnabled()) ! log.logDebug("Executing statement: " + sqlStatement); rs = stmt.executeQuery(sqlStatement); *************** *** 253,258 **** getDocument().put(name, value); ! LogService.getInstance().logDebug("Adding new attribute: " + name + ! "=" + value); } } --- 257,263 ---- getDocument().put(name, value); ! if(log.isDebugEnabled()) ! log.logDebug("Adding new attribute: " + name + ! "=" + value); } } *************** *** 279,284 **** getDocument().put(varname, value); ! LogService.getInstance().logDebug("Adding new attribute: " + varname + ! "=" + value); } } --- 284,290 ---- getDocument().put(varname, value); ! if(log.isDebugEnabled()) ! log.logDebug("Adding new attribute: " + varname + ! "=" + value); } } *************** *** 326,330 **** conn = getConnection(); stmt = conn.createStatement(); ! LogService.getInstance().logDebug("Executing " + sqlStatement); rs = stmt.executeQuery(sqlStatement); result = null; --- 332,337 ---- conn = getConnection(); stmt = conn.createStatement(); ! if(log.isDebugEnabled()) ! log.logDebug("Executing " + sqlStatement); rs = stmt.executeQuery(sqlStatement); result = null; |