---
title: Logging in identity-related scripts
description: Identity-related logs can be used in scripts created for custom endpoints or script triggers.
component: pingoneaic
page_id: pingoneaic:idm-scripting:scripting-func-logs
canonical_url: https://docs.pingidentity.com/pingoneaic/idm-scripting/scripting-func-logs.html
keywords: ["Scripts", "Logs"]
---

# Logging in identity-related scripts

Identity-related logs can be used in scripts created for [custom endpoints](script-custom-endpoints.html) or [script triggers](script-triggers.html).

Advanced Identity Cloud provides a `logger` object to access the Simple Logging Facade for Java (SLF4J) facilities. The following code shows an example of the `logger` object.

```javascript
logger.info("Parameters passed in: {} {} {}", param1, param2, param3);
```

In addition, JavaScript has a useful logging function named `console.log()`. This function provides an easy way to dump data to the Advanced Identity Cloud standard output (usually the same output as the OSGi console). The function works well with the JavaScript built-in function `JSON.stringify` and provides fine-grained details about any given object. For example, the following line will print a formatted JSON structure that represents the HTTP request details to STDOUT.

```javascript
console.log(JSON.stringify(context.http, null, 4));
```

The script engine supports the following log functions:

> **Collapse: logger.debug(string message, object... params)**
>
> Logs a message at DEBUG level.
>
> * Parameters
>
>   * message
>
>     string
>
>     The message format to log. Params replace `{}` in your message.
>
>   * params
>
>     object
>
>     Arguments to include in the message.
>
> * Returns
>
>   A `null` value if successful.
>
> * Throws
>
>   An exception is thrown if the message could not be logged.

> **Collapse: logger.error(string message, object... params)**
>
> Logs a message at ERROR level.
>
> * Parameters
>
>   * message
>
>     string
>
>     The message format to log. Params replace `{}` in your message.
>
>   * params
>
>     object
>
>     Arguments to include in the message.
>
> * Returns
>
>   A `null` value if successful.
>
> * Throws
>
>   An exception is thrown if the message could not be logged.

> **Collapse: logger.info(string message, object... params)**
>
> Logs a message at INFO level.
>
> * Parameters
>
>   * message
>
>     string
>
>     The message format to log. Params replace `{}` in your message.
>
>   * params
>
>     object
>
>     Arguments to include in the message.
>
> * Returns
>
>   A `null` value if successful.
>
> * Throws
>
>   An exception is thrown if the message could not be logged.

> **Collapse: logger.trace(string message, object... params)**
>
> Logs a message at TRACE level.
>
> * Parameters
>
>   * message
>
>     string
>
>     The message format to log. Params replace `{}` in your message.
>
>   * params
>
>     object
>
>     Arguments to include in the message.
>
> * Returns
>
>   A `null` value if successful.
>
> * Throws
>
>   An exception is thrown if the message could not be logged.

> **Collapse: logger.warn(string message, object... params)**
>
> Logs a message at WARN level.
>
> * Parameters
>
>   * message
>
>     string
>
>     The message format to log. Params replace `{}` in your message.
>
>   * params
>
>     object
>
>     Arguments to include in the message.
>
> * Returns
>
>   A `null` value if successful.
>
> * Throws
>
>   An exception is thrown if the message could not be logged.
