com.proofpoint.log.Logger.warn()方法的使用及代码示例

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

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

Logger.warn介绍

[英]Logs a message at WARN level.

Usage example:

logger.warn("something bad happened when connecting to %s:%d", host, port);

If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.
[中]以警告级别记录消息。
用法示例:

logger.warn("something bad happened when connecting to %s:%d", host, port);

如果格式字符串无效或参数不足,将记录错误并继续执行。

代码示例

代码示例来源:origin: com.proofpoint.platform/log

/**
 * Logs a message at WARN level.
 * <p>
 * Usage example:
 * <pre>
 *    logger.warn("something bad happened when connecting to %s:%d", host, port);
 * </pre>
 * If the format string is invalid or the arguments are insufficient, an error will be logged and execution
 * will continue.
 *
 * @param format a format string compatible with String.format()
 * @param args arguments for the format string
 */
public void warn(String format, Object... args)
{
  warn(null, format, args);
}

代码示例来源:origin: com.proofpoint.platform/bootstrap

@Override
public void onWarning(String message)
{
  if (loggingInitialized.get()) {
    log.warn(message);
  }
  else {
    warnings.add(message);
  }
}

代码示例来源:origin: com.proofpoint.galaxy/galaxy-cli

public void warn(WARNING_ID id, String message, Object... data)
{
  String msg;
  try {
    msg = String.format(message, data);
  }
  catch (IllegalFormatException e) {
    msg = message + " " + Arrays.toString(data);
  }
  Logger.get("jnr-posix").warn(msg);
}

代码示例来源:origin: com.proofpoint.platform/log

public static void addShutdownHookToWaitFor(Thread shutdownHook)
{
  LogManager logManager = LogManager.getLogManager();
  if (logManager instanceof ShutdownWaitingLogManager) {
    ((ShutdownWaitingLogManager) logManager).addWaitForShutdownHook(shutdownHook);
  } else {
    log.warn("LogManager is not a ShutdownWaitingLogManager, so shutdown hooks might not be able to log. Please run java with -Djava.util.logging.manager=%s",
        ShutdownWaitingLogManager.class.getTypeName());
  }
}

代码示例来源:origin: com.proofpoint.platform/log

private static void recoverTempFiles(String logPath)
{
  // Logback has a tendency to leave around temp files if it is interrupted.
  // These .tmp files are log files that are about to be compressed.
  // This method recovers them so that they aren't orphaned.
  File logPathFile = new File(logPath).getParentFile();
  File[] tempFiles = logPathFile.listFiles((dir, name) -> name.endsWith(TEMP_FILE_EXTENSION));
  if (tempFiles == null) {
    return;
  }
  for (File tempFile : tempFiles) {
    String newName = tempFile.getName().substring(0, tempFile.getName().length() - TEMP_FILE_EXTENSION.length());
    File newFile = new File(tempFile.getParent(), newName + LOG_FILE_EXTENSION);
    if (!tempFile.renameTo(newFile)) {
      log.warn("Could not rename temp file [%s] to [%s]", tempFile, newFile);
    }
  }
}

代码示例来源:origin: com.proofpoint.galaxy/galaxy-agent

log.warn("Invalid slot id [" + slotIdString + "]: attempting to delete galaxy-slot-id.txt file and recreating a new one");
slotIdFile.delete();

代码示例来源:origin: com.proofpoint.platform/http-client

try {
  exceptionCache.get(exception.getClass(), () -> {
    log.warn(exception, "Exception querying %s",
        request.getUri().resolve("/"));
    isLogged.set(true);
  log.warn("Exception querying %s: %s",
      request.getUri().resolve("/"),
      exception);

代码示例来源:origin: com.proofpoint.galaxy/galaxy-agent

log.warn("Unable to delete temp directory: %s", tempDir.getAbsolutePath());

代码示例来源:origin: com.proofpoint.platform/reporting-client

public void report(long systemTimeMillis, Table<String, Map<String, String>, Object> collectedData)
{
  Request request = preparePost()
      .setUri(UPLOAD_URI)
      .setHeader("Content-Type", "application/gzip")
      .setBodySource(new CompressBodySource(systemTimeMillis, collectedData))
      .build();
  try {
    StringResponse response = httpClient.execute(request, createStringResponseHandler());
    if (response.getStatusCode() != 204) {
      logger.warn("Failed to report stats: %s %s %s", response.getStatusCode(), response.getStatusMessage(), response.getBody());
    }
  }
  catch (RuntimeException e) {
    logger.warn(e, "Exception when trying to report stats");
  }
}

代码示例来源:origin: com.proofpoint.platform/http-client

@Override
public T handle(Request request, Response response)
    throws RetryException
{
  String failureCategory = response.getStatusCode() + " status code";
  if (RETRYABLE_STATUS_CODES.contains(response.getStatusCode())) {
    String retryHeader = response.getHeader("X-Proofpoint-Retry");
    log.warn("%d response querying %s",
        response.getStatusCode(), request.getUri().resolve("/"));
    if (!("no".equalsIgnoreCase(retryHeader)) && bodySourceRetryable(request) && retryBudget.canRetry()) {
      throw new RetryException(failureCategory);
    }
    Object result;
    try {
      result = innerHandler.handle(request, response);
    }
    catch (Exception e) {
      throw new InnerHandlerException(e, failureCategory);
    }
    throw new FailureStatusException(result, failureCategory);
  }
  try {
    return innerHandler.handle(request, response);
  }
  catch (Exception e) {
    throw new InnerHandlerException(e, failureCategory);
  }
}

代码示例来源:origin: com.proofpoint.platform/cassandra-experimental

log.warn("Unable to start GCInspector (currently only supported on the Sun JVM)");

相关文章