@VisibleForTesting protected String getLogBuffer( VariableSpace space, String logChannelId, LogStatus status, String limit ) { LoggingBuffer loggingBuffer = KettleLogStore.getAppender(); // if job is starting, then remove all previous events from buffer with that job logChannelId. // Prevents recursive job calls logging issue. if ( status.getStatus().equalsIgnoreCase( String.valueOf( LogStatus.START ) ) ) { loggingBuffer.removeChannelFromBuffer( logChannelId ); } StringBuffer buffer = loggingBuffer.getBuffer( logChannelId, true ); if ( Utils.isEmpty( limit ) ) { String defaultLimit = space.getVariable( Const.KETTLE_LOG_SIZE_LIMIT, null ); if ( !Utils.isEmpty( defaultLimit ) ) { limit = defaultLimit; } } // See if we need to limit the amount of rows // int nrLines = Utils.isEmpty( limit ) ? -1 : Const.toInt( space.environmentSubstitute( limit ), -1 ); if ( nrLines > 0 ) { int start = buffer.length() - 1; for ( int i = 0; i < nrLines && start > 0; i++ ) { start = buffer.lastIndexOf( Const.CR, start - 1 ); } if ( start > 0 ) { buffer.delete( 0, start + Const.CR.length() ); } } return buffer.append( Const.CR + status.getStatus().toUpperCase() + Const.CR ).toString(); }
/** * Find the LogStatus based on the string description of the status. * * @param status * the status string to search for * @return the LogStatus or null if none is found */ public static LogStatus findStatus( String status ) { for ( LogStatus logStatus : values() ) { if ( logStatus.status.equalsIgnoreCase( status ) ) { return logStatus; } } return null; } }
boolean update = ( logTable.getKeyField() != null ) && !status.equals( LogStatus.START ); String schemaTable = databaseMeta.getQuotedSchemaTableCombination(
status = LogStatus.findStatus( statusString ); } else if ( status != null && LogStatus.STOP.equals( status ) ) { item.setBackground( GUIResource.getInstance().getColorYellow() );
if ( status.equals( LogStatus.END ) ) { ldb.cleanupLogRecords( performanceLogTable );
status = LogStatus.findStatus( statusString ); } else if ( status != null && LogStatus.STOP.equals( status ) ) { item.setBackground( GUIResource.getInstance().getColorYellow() );
if ( status.equals( LogStatus.END ) || status.equals( LogStatus.STOP ) ) { ldb.cleanupLogRecords( transLogTable ); transMeta.getTransLogTable().getActualTableName() ), e ); } finally { if ( intervalInSeconds <= 0 || ( status.equals( LogStatus.END ) || status.equals( LogStatus.STOP ) ) ) { ldb.disconnect();
if ( status.equalsIgnoreCase( LogStatus.END.getStatus() ) ) { evaluation = "Ended"; } else if ( status.equalsIgnoreCase( LogStatus.START.getStatus() ) ) { evaluation = "Started"; } else if ( status.equalsIgnoreCase( LogStatus.STOP.getStatus() ) ) { evaluation = "Stopped"; } else if ( status.equalsIgnoreCase( LogStatus.RUNNING.getStatus() ) ) { evaluation = "Running"; } else if ( status.equalsIgnoreCase( LogStatus.PAUSED.getStatus() ) ) { evaluation = "Paused"; } else if ( status.equalsIgnoreCase( LogStatus.ERROR.getStatus() ) ) { evaluation = "Failed"; } else {
/** * Writes information to Job Log table. Cleans old records, in case job is finished. */ protected void writeLogTableInformation( JobLogTable jobLogTable, LogStatus status ) throws KettleJobException, KettleDatabaseException { boolean cleanLogRecords = status.equals( LogStatus.END ); String tableName = jobLogTable.getActualTableName(); DatabaseMeta logcon = jobLogTable.getDatabaseMeta(); Database ldb = createDataBase( logcon ); ldb.shareVariablesWith( this ); try { ldb.connect(); ldb.setCommit( logCommitSize ); ldb.writeLogRecord( jobLogTable, status, this, null ); if ( cleanLogRecords ) { ldb.cleanupLogRecords( jobLogTable ); } } catch ( KettleDatabaseException dbe ) { addErrors( 1 ); throw new KettleJobException( "Unable to end processing by writing log record to table " + tableName, dbe ); } finally { if ( !ldb.isAutoCommit() ) { ldb.commitLog( true, jobLogTable ); } ldb.disconnect(); } }
break; case STATUS: value = status.getStatus(); break; case LINES_READ:
break; case STATUS: value = status.getStatus(); break; case LINES_READ: