---
title: Configuring logging in React Native
description: Configure logging in React Native apps using the Orchestration SDK to debug authentication flows, set log levels, and redirect output to a custom sink
component: orchsdks
page_id: orchsdks:journey:customization/logging/react-native-custom-logging
canonical_url: https://developer.pingidentity.com/orchsdks/journey/customization/logging/react-native-custom-logging.html
llms_txt: https://developer.pingidentity.com/orchsdks/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
keywords: ["Journeys", "React Native", "Logging", "Debug", "Console"]
section_ids:
  installing_the_logger_module: Installing the logger module
  configuring_logging: Configuring logging
  log_levels: Log levels
  native_log_levels: Native log levels
  changing_the_log_level_at_runtime: Changing the log level at runtime
  customizing_logging_output: Customizing logging output
---

# Configuring logging in React Native

[icon: circle-check, set=far]PingOne Advanced Identity Cloud [icon: circle-check, set=far]PingAM [icon: react, set=fab]React Native

When you develop applications with the Orchestration SDK, you might need to understand its internal workings or troubleshoot unexpected behavior.

Use logging to gain crucial insights into your application's operations, identify issues, verify expected functionality, and better understand authentication flows.

This section covers how to configure and customize the logging output from the Orchestration SDK for React Native.

## Installing the logger module

The logger is provided by a separate package. Install it alongside `@ping-identity/rn-journey`:

* yarn

* npm

```shell
yarn add @ping-identity/rn-logger
```

```shell
npm install @ping-identity/rn-logger
```

After installation, run `pod install` in your `ios/` directory to link the native dependencies on iOS:

```shell
cd ios && pod install
```

## Configuring logging

To configure logging, create a logger instance with `logger()` from `@ping-identity/rn-logger` and pass it to `createJourneyClient()` in the `logger` property.

Configuring the log level in the Journey client

```typescript
import { createJourneyClient } from '@ping-identity/rn-journey';
import { logger } from '@ping-identity/rn-logger';

const log = logger({ level: 'warn' });

const journeyClient = createJourneyClient({
  serverUrl: 'https://openam-forgerock-sdks.forgeblocks.com/am',
  realm: 'alpha',
  cookie: 'ch15fefc5407912',
  logger: log,
});
```

The logger is registered with the native layer on both Android and iOS, so messages from the native modules are routed through the same instance.

By default, logging is disabled (`level: 'none'`) when no logger is provided.

|   |                                                                                                                                                                                                                                                                                                                                     |
| - | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | `logger()` throws an error if native logger registration fails.Wrap the call in a `try/catch` block if you need to handle this case:Handling logger registration failure```typescript
try {
  const log = logger({ level: 'info' });
  // use log ...
} catch (error) {
  console.error('Failed to configure logger', error);
}
``` |

### Log levels

The Orchestration SDK for React Native supports the following log levels:

| Level   | Description                                                                         |
| ------- | ----------------------------------------------------------------------------------- |
| `none`  | Disables all log output. This is the default when no level is specified.            |
| `error` | Outputs error messages only.                                                        |
| `warn`  | Outputs warning and error messages.                                                 |
| `info`  | Outputs informational, warning, and error messages.                                 |
| `debug` | Outputs all messages, including verbose diagnostic output intended for development. |

The Orchestration SDK outputs messages that have a priority equal to, or greater than your chosen level. For example, setting the level to `warn` outputs both `warn` and `error` messages.

### Native log levels

Internally, the JavaScript levels map to three native logger levels on Android and iOS:

| JavaScript level | Native level |
| ---------------- | ------------ |
| `debug`, `info`  | `STANDARD`   |
| `warn`, `error`  | `WARN`       |
| `none`           | `NONE`       |

### Changing the log level at runtime

Call `changeLevel()` on the logger instance to update the level after initialisation. The change is applied to both the JavaScript and native layers immediately.

Changing the log level at runtime

```typescript
log.changeLevel('debug');
```

## Customizing logging output

By default, the Orchestration SDK writes messages to the standard JavaScript console, for example `console.log`, and `console.warn`.

To redirect log output, for example to a crash reporting service or a structured logging library, provide a `custom` object when creating the logger.

Each method receives the log arguments and must return `true` to indicate that the message was handled.

Redirecting SDK logs to a custom sink

```typescript
import { logger } from '@ping-identity/rn-logger';

const log = logger({
  level: 'debug',
  custom: {
    error: (...args) => { sendToReportingService('error', args); return true; },
    warn:  (...args) => { sendToReportingService('warn',  args); return true; },
    info:  (...args) => { sendToReportingService('info',  args); return true; },
    debug: (...args) => { sendToReportingService('debug', args); return true; },
  },
});
```

If the `custom` configuration is omitted, the Orchestration SDK for React Native falls back to the default console methods.
