Esempio n. 1
0
  /** Add a new appender and context to the NDC for this execution of the step */
  private void setupNDCLogging() {
    String nestedDiagnosticContext = getNestedDiagnosticContext();
    logFileName = getLogFileName(nestedDiagnosticContext);

    ndcAppender = null;
    ndcSet = false;
    try {
      ndcAppender = new FileAppender(BatchLogger.getLogFileAppenderLayout(), logFileName);
      ndcAppender.addFilter(new NDCFilter(nestedDiagnosticContext));
      Logger.getRootLogger().addAppender(ndcAppender);
      NDC.push(nestedDiagnosticContext);
      ndcSet = true;
    } catch (Exception ex) {
      LOG.warn("Could not initialize custom logging for step: " + step.getName(), ex);
    }
  }
Esempio n. 2
0
  /**
   * @param parameterService the ParameterService used by Job
   * @param dateTimeService the DateTimeService used by Job
   * @param batchContainerDirectory the batch container directory
   * @param batchStepFile the descriptor containing information about the step to execute
   * @param step the Step to execute
   * @param stepIndex the index of the step in the job
   */
  public BatchStepExecutor(
      ParameterService parameterService,
      DateTimeService dateTimeService,
      BatchContainerDirectory batchContainerDirectory,
      BatchStepFileDescriptor batchStepFile,
      Step step,
      int stepIndex) {
    BatchLogger.addConsoleAppender(LOG);

    this.parameterService = parameterService;
    this.dateTimeService = dateTimeService;

    this.batchContainerDirectory = batchContainerDirectory;
    this.batchStepFile = batchStepFile;
    this.step = step;
    this.stepIndex = stepIndex;

    this.containerStepListeners = new ArrayList<ContainerStepListener>();

    LOG.info("Initialized thread executor for " + batchStepFile);
  }