当前位置: 首页>>代码示例>>Java>>正文


Java Database.writeLogRecord方法代码示例

本文整理汇总了Java中org.pentaho.di.core.database.Database.writeLogRecord方法的典型用法代码示例。如果您正苦于以下问题:Java Database.writeLogRecord方法的具体用法?Java Database.writeLogRecord怎么用?Java Database.writeLogRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.core.database.Database的用法示例。


在下文中一共展示了Database.writeLogRecord方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: endProcessing

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
public boolean endProcessing(String status, Result res) throws KettleJobException
{
	try
	{
		long read=res.getNrLinesRead();
        long written=res.getNrLinesWritten();
        long updated=res.getNrLinesUpdated();
        long errors=res.getNrErrors();
        long input=res.getNrLinesInput();
        long output=res.getNrLinesOutput();
        
        if (errors==0 && !res.getResult()) errors=1;
		
		logDate     = new Date();

        // Change the logging back to stream...
        String log_string = null;
        
        if (jobMeta.isLogfieldUsed())
        {
            log_string = stringAppender.getBuffer().append(Const.CR+"END"+Const.CR).toString();
            log.removeAppender(stringAppender);
        }
        
		/*
		 * Sums errors, read, written, etc.
		 */		

		DatabaseMeta logcon = jobMeta.getLogConnection();
		if (logcon!=null)
		{
			Database ldb = new Database(logcon);
			ldb.shareVariablesWith(this);
			try
			{
				ldb.connect();
				ldb.writeLogRecord(jobMeta.getLogTable(), jobMeta.isBatchIdUsed(), getBatchId(), true, jobMeta.getName(), status, 
				                   read,written,updated,input,output,errors, 
				                   startDate, endDate, logDate, depDate, currentDate,
								   log_string
								   );
			}
			catch(KettleDatabaseException dbe)
			{
				addErrors(1);
				throw new KettleJobException("Unable to end processing by writing log record to table "+jobMeta.getLogTable(), dbe);
			}
			finally
			{
				ldb.disconnect();
			}
		}
        
		return true;
	}
	catch(Exception e)
	{
		throw new KettleJobException(e); // In case something else goes wrong.
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:61,代码来源:Job.java

示例2: endProcessing

import org.pentaho.di.core.database.Database; //导入方法依赖的package包/类
private boolean endProcessing() throws KettleJobException
{
	LogStatus status;
	if (!isActive()) {
		if (isStopped()) {
			status = LogStatus.STOP;
		} else {
			status = LogStatus.END;
		}
	} else {
		status = LogStatus.RUNNING;
	}
	try
	{
        if (errors.get()==0 && result!=null && !result.getResult()) {
        	errors.incrementAndGet();
        }
		
		logDate     = new Date();

		/*
		 * Sums errors, read, written, etc.
		 */		
		
		JobLogTable jobLogTable = jobMeta.getJobLogTable();
		if (jobLogTable.isDefined()) {

			String tableName = jobMeta.getJobLogTable().getActualTableName();
			DatabaseMeta logcon = jobMeta.getJobLogTable().getDatabaseMeta();

			Database ldb = new Database(this, logcon);
			ldb.shareVariablesWith(this);
			try
			{
				ldb.connect();
 	            ldb.setCommit(logCommitSize);
				ldb.writeLogRecord(jobMeta.getJobLogTable(), status, this, null);
			}
			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.commit(true);
				ldb.disconnect();
			}
		}
        
		return true;
	}
	catch(Exception e)
	{
		throw new KettleJobException(e); // In case something else goes wrong.
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:58,代码来源:Job.java


注:本文中的org.pentaho.di.core.database.Database.writeLogRecord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。