本文整理汇总了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.
}
}
示例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.
}
}