Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

logger- Global

The logger API provides inbound email actions that append messages to the email log.

It provides methods that add information, warning, and error messages. The added message has its source set to email.<Sys ID of incoming email>.

Parent Topic:Server API reference

logger - log(String msg)

Appends the specified message to the email log.

NameTypeDescription
msgStringText to append to the email log. These should be information type messages.
TypeDescription
void 

This code example queries email from the sys_user table and then calls the appropriate logger method based on the sender information.

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(String msg)

Appends the specified error message to the email log file.

NameTypeDescription
msgStringError message to append to the email log
TypeDescription
void 

This code example queries email from the sys_user table and then calls the appropriate logger method based on the sender information.

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(String msg)

Appends the specified warning message to the email log file.

NameTypeDescription
msgStringWarning message to append to the email log
TypeDescription
void 

This code example queries email from the sys_user table and then calls the appropriate logger method based on the sender information.

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);
  }