use of org.pentaho.di.core.logging.LoggingHierarchy in project pentaho-kettle by pentaho.
the class Trans method getLoggingHierarchy.
/**
* Gets the logging hierarchy.
*
* @return the logging hierarchy
*/
public List<LoggingHierarchy> getLoggingHierarchy() {
List<LoggingHierarchy> hierarchy = new ArrayList<>();
List<String> childIds = LoggingRegistry.getInstance().getLogChannelChildren(getLogChannelId());
for (String childId : childIds) {
LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject(childId);
if (loggingObject != null) {
hierarchy.add(new LoggingHierarchy(getLogChannelId(), batchId, loggingObject));
}
}
return hierarchy;
}
use of org.pentaho.di.core.logging.LoggingHierarchy in project pentaho-kettle by pentaho.
the class Job method writeLogChannelInformation.
/**
* Write log channel information.
*
* @throws KettleException
* the kettle exception
*/
protected void writeLogChannelInformation() throws KettleException {
Database db = null;
ChannelLogTable channelLogTable = jobMeta.getChannelLogTable();
// PDI-7070: If parent job has the same channel logging info, don't duplicate log entries
Job j = getParentJob();
if (j != null) {
if (channelLogTable.equals(j.getJobMeta().getChannelLogTable())) {
return;
}
}
try {
db = new Database(this, channelLogTable.getDatabaseMeta());
db.shareVariablesWith(this);
db.connect();
db.setCommit(logCommitSize);
List<LoggingHierarchy> loggingHierarchyList = getLoggingHierarchy();
for (LoggingHierarchy loggingHierarchy : loggingHierarchyList) {
db.writeLogRecord(channelLogTable, LogStatus.START, loggingHierarchy, null);
}
// Also time-out the log records in here...
//
db.cleanupLogRecords(channelLogTable, getJobname());
} catch (Exception e) {
throw new KettleException(BaseMessages.getString(PKG, "Trans.Exception.UnableToWriteLogChannelInformationToLogTable"), e);
} finally {
if (!db.isAutoCommit()) {
db.commit(true);
}
db.disconnect();
}
}
use of org.pentaho.di.core.logging.LoggingHierarchy in project pentaho-kettle by pentaho.
the class Job method getLoggingHierarchy.
/**
* Gets the logging hierarchy.
*
* @return the logging hierarchy
*/
public List<LoggingHierarchy> getLoggingHierarchy() {
List<LoggingHierarchy> hierarchy = new ArrayList<LoggingHierarchy>();
List<String> childIds = LoggingRegistry.getInstance().getLogChannelChildren(getLogChannelId());
for (String childId : childIds) {
LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject(childId);
if (loggingObject != null) {
hierarchy.add(new LoggingHierarchy(getLogChannelId(), batchId, loggingObject));
}
}
return hierarchy;
}
use of org.pentaho.di.core.logging.LoggingHierarchy in project pentaho-kettle by pentaho.
the class Trans method writeLogChannelInformation.
/**
* Writes log channel information to a channel logging table (if one has been configured).
*
* @throws KettleException if any errors occur during logging
*/
protected void writeLogChannelInformation() throws KettleException {
Database db = null;
ChannelLogTable channelLogTable = transMeta.getChannelLogTable();
// PDI-7070: If parent trans or job has the same channel logging info, don't duplicate log entries
Trans t = getParentTrans();
if (t != null) {
if (channelLogTable.equals(t.getTransMeta().getChannelLogTable())) {
return;
}
}
Job j = getParentJob();
if (j != null) {
if (channelLogTable.equals(j.getJobMeta().getChannelLogTable())) {
return;
}
}
try {
db = new Database(this, channelLogTable.getDatabaseMeta());
db.shareVariablesWith(this);
db.connect();
db.setCommit(logCommitSize);
List<LoggingHierarchy> loggingHierarchyList = getLoggingHierarchy();
for (LoggingHierarchy loggingHierarchy : loggingHierarchyList) {
db.writeLogRecord(channelLogTable, LogStatus.START, loggingHierarchy, null);
}
// Also time-out the log records in here...
//
db.cleanupLogRecords(channelLogTable, getName());
} catch (Exception e) {
throw new KettleException(BaseMessages.getString(PKG, "Trans.Exception.UnableToWriteLogChannelInformationToLogTable"), e);
} finally {
disconnectDb(db);
}
}
Aggregations