nablarch.core.log.Logger.logInfo()方法的使用及代码示例

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

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

Logger.logInfo介绍

[英]INFOレベルでログを出力する。
[中]信息レベルでログを出力する。

代码示例

代码示例来源:origin: com.nablarch.framework/nablarch-core-applog

/**
 * {@inheritDoc}
 * 総コミット件数をログ出力する。
 * 初期化が行われていない場合は、何も行わない。
 */
public synchronized void terminate() {
  if (!initialized) {
    return;
  }
  initialized = false;
  totalCommitCount += commitCount;
  LOGGER.logInfo("TOTAL COMMIT COUNT = [" + totalCommitCount + ']');
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-web-tag

/**
 * {@inheritDoc}<br>
 * 例外をINFOレベルでログ出力する。
 */
public void doCatch(Throwable e) throws Throwable {
  LOGGER.logInfo("exception occurred.", e);
  throw e;
}
/** {@inheritDoc} */

代码示例来源:origin: com.nablarch.framework/nablarch-fw-batch-ee

/**
   * メッセージをログに出力する。
   * @param message メッセージ
   */
  public static void write(final String message) {
    LOGGER.logInfo(message);
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-core-applog

/**
 * コミット件数を加算する。
 *
 * コミット件数を加算した結果、ログ出力間隔を超えた場合にはコミットログの出力を行う。
 * 初期化が行われていない場合は、{@link IllegalStateException}を送出する。
 *
 * {@inheritDoc}
 * @throws IllegalStateException 本オブジェクトが初期化されていない場合
 */
public synchronized void increment(long count) throws IllegalStateException {
  if (!initialized) {
    throw new IllegalStateException("not initialized object.");
  }
  commitCount += count;
  if (commitCount >= interval) {
    totalCommitCount += commitCount;
    commitCount = 0;
    LOGGER.logInfo("COMMIT COUNT = [" + totalCommitCount + ']');
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw

@Override
public void shutdownService() {
  if (executorService == null) {
    // shutdown対象が存在しない場合は何もしない
    return;
  }
  try {
    awaitTermination();
  } catch (InterruptedException e) {
    LOGGER.logInfo("interrupted in ExecutorService#awaitTermination.", e);
    Thread.interrupted();
  }
  executorService.shutdownNow();
  LOGGER.logInfo("shutdown finished.");
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw

@Override
public void startShutdownService() {
  if (!needsShutdown()) {
    return;
  }
  LOGGER.logInfo("starting shutdown. no more request will be accepted.");
  executorService.shutdown();
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-jaxrs

/**
 * エンコーディング名の正当性を確認する。
 * <p/>
 * 不正なエンコーディング名であれば{@link HttpErrorResponse}を送出する。
 *
 * @param encoding エンコーディング
 */
private static void validateEncoding(final String encoding) {
  try {
    Charset.forName(encoding);
  } catch (RuntimeException e) {
    LOGGER.logInfo("consumes charset is invalid. charset = [" + encoding + ']');
    throw new HttpErrorResponse(400, e);
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-web-tag

/**
 * 開閉局ステータスチェック中に発生したエラーを処理する。
 * 
 * 捕捉した例外をINFOレベルのログに出力し、falseをリターンする。
 * 
 * @param e 起因例外
 * @return 必ずfalseを返却する。
 *          (ボタン・リンクの表示制御は行われず、通常と同様の表示となる。)
 */
private boolean handleError(Throwable e) {
  if (LOGGER.isInfoEnabled()) {
    LOGGER.logInfo(
      "Failed to pre-check the availability of business services. "
     + "It is needed for determining appearance of some buttons and links. "
     + "(They are showed in ordinal appearance.)"
     , e
    );
  }
  return false;
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-messaging-http

/**
 * メッセージングの証跡ログを出力する。
 * @param message メッセージオブジェクト
 * @param charset 出力に使用する文字レット
 */
private void emitLog(InterSystemMessage<?> message, Charset charset) {
  
  String log = (message instanceof ReceivedMessage)
        ? MessagingLogUtil.getHttpReceivedMessageLog((ReceivedMessage) message, charset)
        : MessagingLogUtil.getHttpSentMessageLog((SendingMessage) message, charset);
  
  MESSAGING_LOGGER.logInfo(log);
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-messaging-http

/**
   * メッセージングの証跡ログを出力する。
   * @param message メッセージオブジェクト
   * @param charset 出力に使用する文字レット
   */
  private void emitLog(InterSystemMessage<?> message, Charset charset) {
    
    String log = (message instanceof ReceivedMessage)
          ? MessagingLogUtil.getHttpReceivedMessageLog((ReceivedMessage) message, charset)
          : MessagingLogUtil.getHttpSentMessageLog((SendingMessage) message, charset);
    
    MESSAGING_LOGGER.logInfo(log);
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-messaging

/**
 * メッセージングの証跡ログを出力する。
 * @param message メッセージオブジェクト
 */
protected void emitLog(InterSystemMessage<?> message) {
  
  String log = (message instanceof ReceivedMessage)
        ? MessagingLogUtil.getReceivedMessageLog((ReceivedMessage) message)
        : MessagingLogUtil.getSentMessageLog((SendingMessage) message);
  LOGGER.logInfo(log);
}

代码示例来源:origin: com.nablarch.framework/nablarch-core

/**
 * 照合に使用するリクエストパスのパターン文字列を設定する。
 * @param requestPattern リクエストパスのパターン文字列
 * @return このインスタンス自体
 */
public RequestPathMatchingHelper
setRequestPattern(String requestPattern) {
  requestPattern = encodeRequestPath(requestPattern.trim());
  Matcher m = REQUEST_PATH_PATTERN_SYNTAX.matcher(requestPattern);
  if (!m.matches()) {
    String message = "Invalid pattern format: " + requestPattern;
    LOGGER.logInfo(message);
    throw new IllegalArgumentException(message);
  }
  directoryPath = m.group(1);
  resourceName  = m.group(2);
  affectsDescendantNodes = directoryPath.endsWith("//");
  hasResourceNamePattern = !StringUtil.isNullOrEmpty(resourceName);
  if (hasResourceNamePattern) {
    resourceNamePattern = Glob.compile(resourceName);
  }
  if (affectsDescendantNodes) {
    directoryPath = directoryPath.replaceAll("//$", "/");
  }
  return this;
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-standalone

/**
 * スレッドプール上の各スレッドの終了状態をログに出力する。
 * @param context 実行コンテキスト
 */
private void reportThreadStatus(ExecutionContext context) {
  StringBuilder report = new StringBuilder(LS);
  for (Future<Result> future : taskTracker) {
    try {
      Result result = future.get();
      report.append("Thread Status: normal end." + LS)
         .append("Thread Result:" + String.valueOf(result) + LS);
    } catch (ExecutionException e) {
      FailureLogUtil.logWarn(e, context.getDataProcessedWhenThrown(e.getCause()), null);
    } catch (InterruptedException e) {
      FailureLogUtil.logWarn(e, context.getDataProcessedWhenThrown(e), null);
    }
  }
  LOGGER.logInfo(report.toString());
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-messaging-http

/**
 * メッセージングの証跡ログを出力する。
 * @param responseHeader 応答ヘッダ情報
 * @param bodyText 変換前の応答メッセージ本文
 * @param charsetName 変換に使用した文字セット
 */
private void emitResponseLog(Map<String, Object> responseHeader, String bodyText, String charsetName) {
  // 共通のログ出力フォーマットとするためReceivedMessageに変換する
  Charset charset = Charset.forName(charsetName);
  byte[] bodyBytes = bodyText.getBytes(charset);
  
  ReceivedMessage receivedMessage = new ReceivedMessage(bodyBytes);
  
  receivedMessage.setHeaderMap(responseHeader);
  
  String log = MessagingLogUtil.getHttpReceivedMessageLog(receivedMessage, charset);
  
  MESSAGING_LOGGER.logInfo(log);
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-standalone

/**
 * メインメソッド。
 * <p/>
 * 本メソッドでは、以下の内容をログ出力する。
 * <ul>
 * <li>起動時</li>
 * 起動オプションや、起動引数(詳細は、{@link LauncherLogUtil#getStartLogMsg(CommandLine)}を参照)
 * <li>終了時</li>
 * 終了コードや処理時間(詳細は、{@link LauncherLogUtil#getEndLogMsg(int, long)}を参照})
 * </ul>
 * 及び処理終了時
 *
 * @param args コマンドライン引数
 */
public static void main(String... args) {
  CommandLine commandLine = new CommandLine(args);
  LauncherLogUtil.initialize();
  LOGGER.logInfo(LauncherLogUtil.getStartLogMsg(commandLine));
  long executeStartTime = System.currentTimeMillis();
  int exitCode = execute(commandLine);
  long executeEndTime = System.currentTimeMillis();
  LOGGER.logInfo(LauncherLogUtil.getEndLogMsg(exitCode,
      executeEndTime - executeStartTime));
  System.exit(exitCode);
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-messaging-http

/**
 * メッセージングの証跡ログを出力する。
 * @param requestHeader 要求ヘッダ情報
 * @param method HTTPメソッド
 * @param uri 接続先URI
 * @param bodyText 変換済みの要求メッセージ本文
 * @param charsetName 変換に使用した文字セット
 */
private void emitRequestLog(Map<String, Object> requestHeader, HttpRequestMethodEnum method, String uri, final String bodyText, String charsetName) {
  // 共通のログ出力フォーマットとするためSendingMessageに変換する
  final Charset charset = Charset.forName(charsetName);
  SendingMessage sendingMessage = new SendingMessage() {
    @Override
    public byte[] getBodyBytes() {
      // ボディ部は変換済みテキストのバイト列を返却する
      return bodyText.getBytes(charset);
    }
  };
  
  sendingMessage.setHeaderMap(requestHeader);
  sendingMessage.setDestination(method + " " + uri);
  
  String log = MessagingLogUtil.getHttpSentMessageLog(sendingMessage, charset);
  
  MESSAGING_LOGGER.logInfo(log);
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-jaxrs

@Override
protected Object convertRequest(HttpRequest request, ExecutionContext context) {
  final JaxRsContext jaxRsContext = JaxRsContext.get(context);
  final Class<?> beanClass = jaxRsContext.getRequestClass();
  final ServletRequest servletRequest = ((ServletExecutionContext) context).getServletRequest();
  final Unmarshaller unmarshaller;
  try {
    unmarshaller = getJAXBContext(beanClass).createUnmarshaller();
    configure(unmarshaller);
  } catch (JAXBException e) {
    throw new IllegalArgumentException("failed to configure Unmarshaller.", e);
  }
  try {
    return unmarshaller.unmarshal(new StreamSource(servletRequest.getReader()), beanClass).getValue();
  } catch (JAXBException e) {
    LOGGER.logInfo("failed to read request. cause = [" + e.getMessage() + ']');
    throw new HttpErrorResponse(HttpResponse.Status.BAD_REQUEST.getStatusCode(), e);
  } catch (IOException e) {
    LOGGER.logInfo("failed to read request. cause = [" + e.getMessage() + ']');
    throw new HttpErrorResponse(HttpResponse.Status.BAD_REQUEST.getStatusCode(), e);
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-core

/**
 * メッセージをログに出力する。
 *
 * @param level ログレベル
 * @param message メッセージ
 */
public static void write(final LogLevel level, final String message) {
  switch (level) {
    case FATAL:
      LOGGER.logFatal(message);
      break;
    case ERROR:
      LOGGER.logError(message);
      break;
    case WARN:
      LOGGER.logWarn(message);
      break;
    case INFO:
      LOGGER.logInfo(message);
      break;
    case DEBUG:
      LOGGER.logDebug(message);
      break;
    case TRACE:
      LOGGER.logTrace(message);
      break;
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-core

/**
   * メッセージをログに出力する。
   * @param level ログレベル
   * @param message メッセージ
   * @param throwable 例外
   */
  public static void write(final LogLevel level, final String message, final Throwable throwable) {
    switch (level) {
      case FATAL:
        LOGGER.logFatal(message, throwable);
        break;
      case ERROR:
        LOGGER.logError(message, throwable);
        break;
      case WARN:
        LOGGER.logWarn(message, throwable);
        break;
      case INFO:
        LOGGER.logInfo(message, throwable);
        break;
      case DEBUG:
        LOGGER.logDebug(message, throwable);
        break;
      case TRACE:
        LOGGER.logTrace(message, throwable);
        break;
    }
  }
}

代码示例来源:origin: com.nablarch.framework/nablarch-fw-messaging-http

LOGGER.logInfo("could not build the message body because of an invalid message error: " + e.getMessage());
throw new HttpErrorResponse(500, e);
LOGGER.logInfo("could not build the message body because of an invalid data error: " + e.getMessage());
throw new HttpErrorResponse(500, e);

相关文章