Search in sources :

Example 16 with LogLevel

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());
}
Also used : LogLevel(org.pentaho.di.core.logging.LogLevel)

Example 17 with LogLevel

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));
}
Also used : Random(java.util.Random) LogLevel(org.pentaho.di.core.logging.LogLevel)

Example 18 with LogLevel

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;
}
Also used : Job(org.pentaho.di.job.Job) KettleException(org.pentaho.di.core.exception.KettleException) UnknownParamException(org.pentaho.di.core.parameters.UnknownParamException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) LogLevel(org.pentaho.di.core.logging.LogLevel)

Example 19 with LogLevel

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();
}
Also used : Binding(org.pentaho.ui.xul.binding.Binding) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) BindingConvertor(org.pentaho.ui.xul.binding.BindingConvertor) LogLevel(org.pentaho.di.core.logging.LogLevel)

Aggregations

LogLevel (org.pentaho.di.core.logging.LogLevel)19 KettleException (org.pentaho.di.core.exception.KettleException)9 Job (org.pentaho.di.job.Job)5 IOException (java.io.IOException)4 PrintWriter (java.io.PrintWriter)4 ServletException (javax.servlet.ServletException)4 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)4 Repository (org.pentaho.di.repository.Repository)4 Trans (org.pentaho.di.trans.Trans)4 ArrayList (java.util.ArrayList)3 ResultFile (org.pentaho.di.core.ResultFile)3 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)3 DefaultLogLevel (org.pentaho.di.core.logging.DefaultLogLevel)3 JobExecutionConfiguration (org.pentaho.di.job.JobExecutionConfiguration)3 JobMeta (org.pentaho.di.job.JobMeta)3 Matchers.anyObject (org.mockito.Matchers.anyObject)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 SlaveServer (org.pentaho.di.cluster.SlaveServer)2 Result (org.pentaho.di.core.Result)2 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)2