io.fabric8.maven.docker.util.Logger.error()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(175)

本文整理了Java中io.fabric8.maven.docker.util.Logger.error()方法的一些代码示例,展示了Logger.error()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.error()方法的具体详情如下:
包路径:io.fabric8.maven.docker.util.Logger
类名称:Logger
方法名:error

Logger.error介绍

[英]Severe errors
[中]严重错误

代码示例

代码示例来源:origin: fabric8io/docker-maven-plugin

@Override
public void error(String error) {
  logger.error("%s", error);
}

代码示例来源:origin: fabric8io/docker-maven-plugin

private void logException(Exception exp) {
  if (exp.getCause() != null) {
    log.error("%s [%s]", exp.getMessage(), exp.getCause().getMessage());
  } else {
    log.error("%s", exp.getMessage());
  }
}

代码示例来源:origin: fabric8io/docker-maven-plugin

@Override
  public void run() {
    try {
      stopStartedContainers(keepContainer, removeVolumes, removeCustomNetworks, null);
    } catch (DockerAccessException | ExecException e) {
      log.error("Error while stopping containers: %s", e.getMessage());
    }
  }
});

代码示例来源:origin: fabric8io/docker-maven-plugin

@Override
public void shutdown() {
  try {
    delegate.close();
  } catch (IOException exp) {
    log.error("Error while closing HTTP client: " + exp,exp);
  }
}

代码示例来源:origin: fabric8io/docker-maven-plugin

private void executeBuildPlugins() {
  try {
    Enumeration<URL> dmpPlugins = Thread.currentThread().getContextClassLoader().getResources(DMP_PLUGIN_DESCRIPTOR);
    while (dmpPlugins.hasMoreElements()) {
      URL dmpPlugin = dmpPlugins.nextElement();
      File outputDir = getAndEnsureOutputDirectory();
      processDmpPluginDescription(dmpPlugin, outputDir);
    }
  } catch (IOException e) {
    log.error("Cannot load dmp-plugins from %s", DMP_PLUGIN_DESCRIPTOR);
  }
}

代码示例来源:origin: fabric8io/docker-maven-plugin

final AssemblyFiles files = archiveService.getAssemblyFiles(imageConfig, mojoParameters);
if (files.isEmpty()) {
  log.error("No assembly files for %s. Are you sure you invoked together with the `package` goal?", imageConfig.getDescription());
  throw new MojoExecutionException("No files to watch found for " + imageConfig);

代码示例来源:origin: fabric8io/docker-maven-plugin

public void wait(ImageConfiguration imageConfig, Properties projectProperties, String containerId) throws IOException {
  List<WaitChecker> checkers = prepareWaitCheckers(imageConfig, projectProperties, containerId);
  int timeout = getTimeOut(imageConfig);
  if (checkers.isEmpty()) {
    if (timeout > 0) {
      log.info("%s: Pausing for %d ms", imageConfig.getDescription(), timeout);
      WaitUtil.sleep(timeout);
    }
    return;
  }
  String logLine = extractCheckerLog(checkers);
  ContainerRunningPrecondition precondition = new ContainerRunningPrecondition(dockerAccess, containerId);
  try {
    long waited = WaitUtil.wait(precondition, timeout, checkers);
    log.info("%s: Waited %s %d ms", imageConfig.getDescription(), logLine, waited);
  } catch (WaitTimeoutException exp) {
    String desc = String.format("%s: Timeout after %d ms while waiting %s",
                  imageConfig.getDescription(), exp.getWaited(),
                  logLine);
    log.error(desc);
    throw new IOException(desc);
  } catch (PreconditionFailedException exp) {
    String desc = String.format("%s: Container stopped with exit code %d unexpectedly after %d ms while waiting %s",
                  imageConfig.getDescription(), precondition.getExitCode(), exp.getWaited(),
                  logLine);
    log.error(desc);
    throw new IOException(desc);
  }
}

代码示例来源:origin: fabric8io/docker-maven-plugin

@Override
  public void run() {
    List<AssemblyFiles.Entry> entries = files.getUpdatedEntriesAndRefresh();
    if (entries != null && entries.size() > 0) {
      try {
        log.info("%s: Assembly changed. Copying changed files to container ...", imageConfig.getDescription());
        File changedFilesArchive = archiveService.createChangedFilesArchive(entries, files.getAssemblyDirectory(),
            imageConfig.getName(), mojoParameters);
        dockerAccess.copyArchive(watcher.getContainerId(), changedFilesArchive, containerBaseDir);
        callPostExec(watcher);
      } catch (MojoExecutionException | IOException | ExecException e) {
        log.error("%s: Error when copying files to container %s: %s",
             imageConfig.getDescription(), watcher.getContainerId(), e.getMessage());
      }
    }
  }
};

代码示例来源:origin: fabric8io/docker-maven-plugin

log.error("Error occurred during container startup, shutting down...");
runService.stopStartedContainers(keepContainer, removeVolumes, autoCreateCustomNetworks, getGavLabel());

代码示例来源:origin: fabric8io/docker-maven-plugin

@Override
  public void run() {
    List<AssemblyFiles.Entry> entries = files.getUpdatedEntriesAndRefresh();
    if (entries != null && entries.size() > 0) {
      try {
        log.info("%s: Assembly changed. Rebuild ...", imageConfig.getDescription());
        if (watcher.getWatchContext().getImageCustomizer() != null) {
          log.info("%s: Customizing the image ...", imageConfig.getDescription());
          watcher.getWatchContext().getImageCustomizer().execute(imageConfig);
        }
        buildService.buildImage(imageConfig, null, buildContext);
        String name = imageConfig.getName();
        watcher.setImageId(queryService.getImageId(name));
        if (doRestart) {
          restartContainer(watcher);
        }
        callPostGoal(watcher);
      } catch (Exception e) {
        log.error("%s: Error when rebuilding - %s", imageConfig.getDescription(), e);
      }
    }
  }
};

代码示例来源:origin: fabric8io/docker-maven-plugin

execInContainer(containerId, descriptor.getPreStop(), descriptor.getImageConfiguration());
} catch (DockerAccessException e) {
  log.error("%s", e.getMessage());
} catch (ExecException e) {
  if (descriptor.isBreakOnError()) {

代码示例来源:origin: fabric8io/fabric8-maven-plugin

/**
 * Logs an error applying some JSON to Kubernetes and optionally throws an exception
 */
protected void onApplyError(String message, Exception e) {
  log.error(message, e);
  throw new RuntimeException(message, e);
}

代码示例来源:origin: fabric8io/fabric8-maven-plugin

@Override
  public void run() {
    try {
      processOutput(process.getInputStream(), createOutputHandler(log, useStandardLoggingLevel));
    } catch (IOException e) {
      log.error("Failed to read output stream from %s : %s", commandDesc, e.getMessage());
    }
  }
};

代码示例来源:origin: fabric8io/fabric8-maven-plugin

@Override
  public void run() {
    try {
      processOutput(process.getErrorStream(), createErrorHandler(log, useStandardLoggingLevel));
    } catch (IOException e) {
      log.error("Failed to read error stream from %s : %s", commandDesc, e.getMessage());
    }
  }
};

代码示例来源:origin: fabric8io/fabric8-maven-plugin

private Date extractDate(TagEvent tag) {
    try {
      return new SimpleDateFormat(DATE_FORMAT).parse(tag.getCreated());
    } catch (ParseException e) {
      log.error("parsing date error : " + e.getMessage(), e);
      return null;
    } catch (NullPointerException e) {
      log.error("tag date is null : " + e.getMessage(), e);
      return null;
    }

  }
}

代码示例来源:origin: fabric8io/fabric8-maven-plugin

@Override
  public Void apply(String outputLine) {
    if (useStandardLoggingLevel) {
      log.error("%s", outputLine);
    } else {
      log.warn("%s", outputLine);
    }
    return null;
  }
};

代码示例来源:origin: fabric8io/fabric8-maven-plugin

@Override
  public void onClose(KubernetesClientException cause) {
    if (cause != null) {
      log.error("Error while watching for build to finish: %s [%d]",
          cause.getMessage(), cause.getCode());
      Status status = cause.getStatus();
      if (status != null) {
        log.error("%s [%s]", status.getReason(), status.getStatus());
      }
    }
    latch.countDown();
  }
};

代码示例来源:origin: fabric8io/fabric8-maven-plugin

private String getLogContainerName(List<Container> containers) {
  if (StringUtils.isNotBlank(context.getLogContainerName())) {
    for (Container container : containers) {
      if (Objects.equals(context.getLogContainerName(), container.getName())) {
        return context.getLogContainerName();
      }
    }
    log.error("log container name %s does not exist in pod!! Did you set the correct value for property 'fabric8.log.container'", context.getLogContainerName());
  }
  return containers.get(0).getName();
}

代码示例来源:origin: io.fabric8/fabric8-maven-enricher-fabric8

protected Probe discoverSpringBootHealthCheck(Integer initialDelay, Integer period, Integer timeout) {
  try {
    if (MavenUtil.hasAllClasses(this.getProject(), REQUIRED_CLASSES)) {
      Properties properties = SpringBootUtil.getSpringBootApplicationProperties(this.getProject());
      return buildProbe(properties, initialDelay, period, timeout);
    }
  } catch (Exception ex) {
    log.error("Error while reading the spring-boot configuration", ex);
  }
  return null;
}

代码示例来源:origin: fabric8io/fabric8-maven-plugin

protected Probe discoverSpringBootHealthCheck(Integer initialDelay, Integer period, Integer timeout, Integer failureTh, Integer successTh) {
  try {
    if (getContext().getProjectClassLoaders().isClassInCompileClasspath(true, REQUIRED_CLASSES)) {
      Properties properties = SpringBootUtil.getSpringBootApplicationProperties(getContext().getProjectClassLoaders().getCompileClassLoader());
      return buildProbe(properties, initialDelay, period, timeout, failureTh, successTh);
    }
  } catch (Exception ex) {
    log.error("Error while reading the spring-boot configuration", ex);
  }
  return null;
}

相关文章