use of org.pentaho.di.core.logging.LogLevel in project pentaho-kettle by pentaho.
the class WriteToLogMetaSymmetric method setLogLevelString.
public void setLogLevelString(String value) {
LogLevel lvl = LogLevel.getLogLevelForCode(value);
super.setLogLevel(lvl.getLevel());
}
use of org.pentaho.di.core.logging.LogLevel in project pentaho-kettle by pentaho.
the class JobEntryWriteToLogLoadSaveTest method createAttributeValidatorsMap.
@Override
protected Map<String, FieldLoadSaveValidator<?>> createAttributeValidatorsMap() {
EnumSet<LogLevel> logLevels = EnumSet.allOf(LogLevel.class);
LogLevel random = (LogLevel) logLevels.toArray()[new Random().nextInt(logLevels.size())];
return toMap("loglevel", new EnumLoadSaveValidator<LogLevel>(random));
}
use of org.pentaho.di.core.logging.LogLevel in project pentaho-platform by pentaho.
the class KettleComponent method executeJob.
private boolean executeJob(final JobMeta jobMeta, final Repository repository) {
boolean success = true;
Job job = null;
try {
if (jobMeta != null) {
try {
job = new Job(repository, jobMeta);
} catch (Exception e) {
throw new KettleComponentException(Messages.getInstance().getErrorString("Kettle.ERROR_0021_BAD_JOB_METADATA"), // $NON-NLS-1$
e);
}
}
if (job == null) {
debug(getKettleLog(true));
throw new KettleComponentException(Messages.getInstance().getErrorString(// $NON-NLS-1$
"Kettle.ERROR_0021_BAD_JOB_METADATA"));
}
// Remember where to get our execution logging from
//
logChannelId = job.getLogChannelId();
try {
if (ComponentBase.debug) {
// $NON-NLS-1$
debug(Messages.getInstance().getString("Kettle.DEBUG_STARTING_JOB"));
}
LogLevel lvl = getLogLevel();
job.setLogLevel(lvl);
job.start();
} catch (Exception e) {
throw new KettleComponentException(Messages.getInstance().getErrorString("Kettle.ERROR_0022_JOB_START_FAILED"), // $NON-NLS-1$
e);
}
try {
// etc.
if (ComponentBase.debug) {
// $NON-NLS-1$
debug(Messages.getInstance().getString("Kettle.DEBUG_JOB_RUNNING"));
}
job.waitUntilFinished();
if (job.getResult().getNrErrors() > 0) {
debug(getKettleLog(true));
throw new KettleComponentException(Messages.getInstance().getErrorString(// $NON-NLS-1$
"Kettle.ERROR_0014_ERROR_DURING_EXECUTE"));
}
} catch (Exception e) {
throw new KettleComponentException(Messages.getInstance().getErrorString("Kettle.ERROR_0014_ERROR_DURING_EXECUTE"), // $NON-NLS-1$
e);
} finally {
if (job != null) {
cleanLogChannel(job);
}
}
// Dump the Kettle log...
debug(getKettleLog(false));
} catch (KettleComponentException e) {
success = false;
// $NON-NLS-1$
error(Messages.getInstance().getErrorString("Kettle.ERROR_0008_ERROR_RUNNING", e.toString()), e);
}
prepareKettleOutput(job);
return success;
}
use of org.pentaho.di.core.logging.LogLevel in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestController method bindSelectedLogLevel.
private void bindSelectedLogLevel(BindingFactory bindingFactory) throws InvocationTargetException, XulException {
Binding logBinding = bindingFactory.createBinding(model, "logLevel", logLevels, "selectedItem");
logBinding.setBindingType(Binding.Type.BI_DIRECTIONAL);
BindingConvertor logLevelConverter = new BindingConvertor<LogLevel, String>() {
@Override
public String sourceToTarget(LogLevel value) {
return value.getDescription();
}
@Override
public LogLevel targetToSource(String value) {
for (LogLevel level : LogLevel.values()) {
if (level.getDescription().equals(value)) {
return level;
}
}
throw new IllegalArgumentException(String.format("'%s' does not correspond to a valid LogLevel value.", value));
}
};
logBinding.setConversion(logLevelConverter);
logBinding.initialize();
logBinding.fireSourceChanged();
}
Aggregations