---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideImportLog - Scoped, Global

# GlideImportLog - Scoped, Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

The GlideImportLog API provides methods to write log entries
directly to the Import Log \[import_log\] table.

A GlideImportLog object is consumable by the GlideImportSetTransformer API. This object is not required for the GlideImportSetTransformer API, it enables you to associate import logs with a
specific Import Set transformation.
**Related concepts**   

* [GlideImportSetRun](https://servicenow-prod.fluidtopics.net/DuUdB5QjbqzVKw9vNXpdgQ#GlideImportSetRunAPI "The GlideImportSetRun API provides methods to creates an Import Set Run record which the GlideImportSetTransformer API can consume.")
* [GlideImportSetTable](https://servicenow-prod.fluidtopics.net/hcK8zq2yc77uOy_947gQmw#GlideImportSetTableAPI "The GlideImportSetTable API provides methods to create temporary Import Set tables.")
* [GlideImportSetTransformer](https://servicenow-prod.fluidtopics.net/58WsAVdtp1Sky5h7T0fw~Q#GlideImportSetTransformerAPI "The GlideImportSetTransformer API provides methods to create an Import Set Transformer object used to execute an Import Set Transform.")
* [GlideImportSetTransformMap](https://servicenow-prod.fluidtopics.net/FN6~ahvPtG3B7g~0D95WzQ#GlideImportSetTransformMapAPI "The GlideImportSetTransformMap API provides methods to create transform maps and transform entries.")
* [GlideTransformLog](https://servicenow-prod.fluidtopics.net/40hOpIutNqObDYC_~w8L~w#GlideTransformLogAPI "The GlideTransformLog API provides methods to create a GlideTransformLog object to log messages to localhost logs.")

## GlideImportLog - GlideImportLog(GlideImportSetRun importSetRun, String source) {#ariaid-title2}

Instantiates a GlideImportLog object.
{#GImportLog-GlideImportLog_O_S__params-glideImportLog__entry__3}{#GImportLog-GlideImportLog_O_S__freddie}

| Name | Type | Description |
|-|-|-|
| importSetRun | GlideImportSetRun | Optional. Import Set Run record on which all logs are to be associated with. |
| source | String | Optional. Source field value attached to the Import Log record that defines where in the Import Set process this message was logged from. For example, Loading could represent loading step, Cleanup could represent during the cleanup after the transform, and so on. |
[Table 1. Parameters]

{#GImportLog-GlideImportLog_O_S__params-glideImportLog}  
Example without optional source parameter.

    var importSetRun = new GlideImportSetRun();
    var importLog = new GlideImportLog(importSetRun);

Example using optional source parameter.

    var importSetRun = new GlideImportSetRun();
    var importLog = new GlideImportLog(importSetRun, 'Scripted ImportSetTransformer');

## GlideImportLog - error(String message, String source) {#ariaid-title3}

Logs a message of type Error to the Import Log \[import_log\] table.

### GlideImportLog {#GImportLog-error_S_S__section_ctq_1br_xjb}

{#GImportLog-error_S_S__params-glideImportLog__entry__3}{#GImportLog-error_S_S__GImpLog_srcParam}

| Name | Type | Description |
|-|-|-|
| message | String | Log message. Maximum length 4000 characters. |
| source | String | Optional. Source field value attached to the Import Log record that defines where in the Import Set process this message was logged from. For example, Loading could represent loading step, Cleanup could represent during the cleanup after the transform, and so on. |
[Table 2. Parameters]

{#GImportLog-error_S_S__params-glideImportLog} {#GImportLog-error_S_S__table_est_vvq_xjb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 3. Returns]

{#GImportLog-error_S_S__table_est_vvq_xjb}  

    var importLog = new GlideImportLog();
    importLog.error('Error executing transform');

## GlideImportLog - getImportRunHistory() {#ariaid-title4}

Returns a sys_id of the Import Run record associated with this Import Log.
{#GImportLog-getImportRunHistory__table_qry_5vq_xjb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 4. Parameters]

{#GImportLog-getImportRunHistory__table_qry_5vq_xjb} {#GImportLog-getImportRunHistory__table_rry_5vq_xjb__entry__2}

| Type | Description |
|-|-|
| String | Sys_id of an Import Set Run record from the Transform History \[sys_import_set_run\] table. |
[Table 5. Returns]

{#GImportLog-getImportRunHistory__table_rry_5vq_xjb}  

    var importSet = new GlideRecord('sys_import_set');
    importSet.name = 'Scripted Import Set';
    importSet.short_description = 'Import set from scripted rest api';
    importSet.table_name = importSetTableName;
    var importSetID = importSet.insert();
    var importLog = new GlideImportLog();
    var transformer = new GlideImportSetTransformer();
    transformer.setLogger(importLog);
    transformer.transformAllMaps(importSet);
    var importRunSysId = importLog.getImportRunHistory();

## GlideImportLog - info(String message, String source) {#ariaid-title5}

Logs a message of type Info to the Import Log \[import_log\] table.

### GlideImportLog {#GImportLog-info_S_S__section_ctq_1br_xjb}

{#GImportLog-info_S_S__params-glideImportLog__entry__3}{#GImportLog-info_S_S__GImpLog_srcParam}

| Name | Type | Description |
|-|-|-|
| message | String | Log message. Maximum length 4000 characters. |
| source | String | Optional. Source field value attached to the Import Log record that defines where in the Import Set process this message was logged from. For example, Loading could represent loading step, Cleanup could represent during the cleanup after the transform, and so on. |
[Table 6. Parameters]

{#GImportLog-info_S_S__params-glideImportLog} {#GImportLog-info_S_S__table_est_vvq_xjb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 7. Returns]

{#GImportLog-info_S_S__table_est_vvq_xjb}  

    var importLog = new GlideImportLog();
    importLog.info('Successfully executed transform');

## GlideImportLog - setImportRunHistory(String importRunHistory) {#ariaid-title6}

Associates the GlideImportLog object with a specific Import Set Run record.
{#GImportLog-setImportRunHistory_S__table_inr_wvq_xjb__entry__3}

| Name | Type | Description |
|-|-|-|
| importRunHistory | String | The sys_id of a record from the Transform History \[sys_import_set_run\] table. |
[Table 8. Parameters]

{#GImportLog-setImportRunHistory_S__table_inr_wvq_xjb} {#GImportLog-setImportRunHistory_S__table_jnr_wvq_xjb__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 9. Returns]

{#GImportLog-setImportRunHistory_S__table_jnr_wvq_xjb}  

    var importRunSysId = '4aa3a8d55ba10010953330ad5981c79f';
    var importLog = new GlideImportLog();
    importLog.setImportRunHistory(importRunSysId);

## GlideImportLog - warn(String message, String source) {#ariaid-title7}

Logs a message of type Warn to the Import Log \[import_log\] table.

### GlideImportLog {#GImportLog-warn_S_S__section_ctq_1br_xjb}

{#GImportLog-warn_S_S__params-glideImportLog__entry__3}{#GImportLog-warn_S_S__GImpLog_srcParam}

| Name | Type | Description |
|-|-|-|
| message | String | Log message. Maximum length 4000 characters. |
| source | String | Optional. Source field value attached to the Import Log record that defines where in the Import Set process this message was logged from. For example, Loading could represent loading step, Cleanup could represent during the cleanup after the transform, and so on. |
[Table 10. Parameters]

{#GImportLog-warn_S_S__params-glideImportLog} {#GImportLog-warn_S_S__table_est_vvq_xjb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 11. Returns]

{#GImportLog-warn_S_S__table_est_vvq_xjb}  

    var importLog = new GlideImportLog();
    importLog.warn('Transform taking longer than expected.');


