---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# ロガー - グローバル

# ロガー - グローバル {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：4分

ロガー API は、メールログにメッセージを追加する受信メールアクションを提供します。

情報、警告、およびエラーメッセージを追加するメソッドを提供します。追加されたメッセージのソースは `email.<Sys ID of incoming email>` に設定されています。

## logger:log(文字列 msg) {#ariaid-title2}

指定されたメッセージをメールログに追加します。
{#r_Logger-log_S__table_ggx_nzv_qx__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| msg | 文字列 | メールログに追加するテキスト。これらは情報タイプのメッセージである必要があります。 |
[表 : 1. パラメーター]

{#r_Logger-log_S__table_ggx_nzv_qx} {#r_Logger-log_S__table_hgx_nzv_qx__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 2. 返される内容]

{#r_Logger-log_S__table_hgx_nzv_qx}  
このコード例では、sys_userテーブルからメールを照会し、送信者情報に基づいて適切なロガーメソッドを呼び出します。

    var grUser = new GlideRecord("sys_user");
    grUser.addQuery("email", email.from);
    grUser.query();
      if (grUser.next()) {
        if (grUser.user_name) {
          logger.log("Sender found: " + email.from); //Append information message to the email log
          createInc(grUser.sys_id);
        } else {
            logger.logWarning("Sender: " + email.from + " " + "found but no userID found, please take necessary actions"); //Append warning message to the email log.
            createInc(grUser.sys_id);
        }
      } else {
          logger.logError("Sender is not present in the system hence action aborted"); //Append error message to the email log.
          current.setAbortAction(true);
      }

## logger:logError(文字列 msg) {#ariaid-title3}

指定されたエラーメッセージをメールログファイルに追加します。
{#r_Logger-logError_S__table_imm_bfw_qx__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| msg | 文字列 | メールログに追加するエラーメッセージ |
[表 : 3. パラメーター]

{#r_Logger-logError_S__table_imm_bfw_qx} {#r_Logger-logError_S__table_jmm_bfw_qx__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 4. 返される内容]

{#r_Logger-logError_S__table_jmm_bfw_qx}  
このコード例では、sys_userテーブルからメールを照会し、送信者情報に基づいて適切なロガーメソッドを呼び出します。

    var grUser = new GlideRecord("sys_user");
    grUser.addQuery("email", email.from);
    grUser.query();
      if (grUser.next()) {
        if (grUser.user_name) {
          logger.log("Sender found: " + email.from); //Append information message to the email log
          createInc(grUser.sys_id);
        } else {
            logger.logWarning("Sender: " + email.from + " " + "found but no userID found, please take necessary actions"); //Append warning message to the email log.
            createInc(grUser.sys_id);
        }
      } else {
          logger.logError("Sender is not present in the system hence action aborted"); //Append error message to the email log.
          current.setAbortAction(true);
      }

## logger:logWarning(文字列 msg) {#ariaid-title4}

指定された警告メッセージをメールログファイルに追加します。
{#r_Logger-logWarning_S__table_ibk_mbw_qx__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| msg | 文字列 | メールログに追加する警告メッセージ |
[表 : 5. パラメーター]

{#r_Logger-logWarning_S__table_ibk_mbw_qx} {#r_Logger-logWarning_S__table_jbk_mbw_qx__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 6. 返される内容]

{#r_Logger-logWarning_S__table_jbk_mbw_qx}  
このコード例では、sys_userテーブルからメールを照会し、送信者情報に基づいて適切なロガーメソッドを呼び出します。

    var grUser = new GlideRecord("sys_user");
    grUser.addQuery("email", email.from);
    grUser.query();
      if (grUser.next()) {
        if (grUser.user_name) {
          logger.log("Sender found: " + email.from); //Append information message to the email log
          createInc(grUser.sys_id);
        } else {
            logger.logWarning("Sender: " + email.from + " " + "found but no userID found, please take necessary actions"); //Append warning message to the email log.
            createInc(grUser.sys_id);
        }
      } else {
          logger.logError("Sender is not present in the system hence action aborted"); //Append error message to the email log.
          current.setAbortAction(true);
      }


