---
title: Customizing logging on Android
description: PingOne Advanced Identity Cloud PingAM Android
component: orchsdks
page_id: orchsdks:journey:customization/logging/android-custom-logging
canonical_url: https://developer.pingidentity.com/orchsdks/journey/customization/logging/android-custom-logging.html
keywords: ["Journeys", "Android", "Logging", "Debug", "Console"]
section_ids:
  configuring_android_logcat_logging: Configuring Android Logcat logging
  defining_and_using_custom_loggers: Defining and using custom loggers
  android_logger_module: Step 1. Installing modules
  step_2_defining_and_using_custom_loggers: Step 2. Defining and using custom loggers
---

# Customizing logging on Android

[icon: circle-check, set=far]PingOne Advanced Identity Cloud [icon: circle-check, set=far]PingAM [icon: android, set=fab]Android

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 Android.

## Configuring Android Logcat logging

To configure the logging output from the Orchestration SDK for Android, specify the logger to use in the client module configuration:

Setting the logging level in the journey client configuration

```kotlin
import com.pingidentity.logger.Logger

val journey = Journey {
  logger = Logger.STANDARD
  serverUrl = "https://openam-forgerock-sdks.forgeblocks.com/am"
  realm = "alpha"
  cookie = "ch15fefc5407912"
}
```

The Orchestration SDK for Android includes the following logger presets:

| Logger preset | Description                                                        |
| ------------- | ------------------------------------------------------------------ |
| `STANDARD`    | Outputs all log messages to the Android Logcat.                    |
| `WARN`        | Outputs only warning and error log messages to the Android Logcat. |
| `NONE`        | Prevents all log messages.                                         |

|   |                                                                                                                                                                                                                                                                                                 |
| - | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | The `STANDARD` logger tags messages in Android Logcat with the Orchestration SDK version. You can filter the console to only show the tagged messages:![Filtering Android Logcat output by tag](../../../_images/logger/android-logcat-tag.png)Figure 1. Filtering Android Logcat output by tag |

## Defining and using custom loggers

In addition to the preset loggers you can create your own loggers. For example, you could output Orchestration SDK for Android messages to a file or a third-party service, or filter which messages to display.

### Step 1. Installing modules

To create custom loggers, you need to add the **Logger** module for Android as a dependency to your project:

* `logging`

To install the module into your Android app:

1. In the **Project** tree view of your Android Studio project, open the `build.gradle.kts` file.

2. In the `dependencies` section, add the `logger` module as a dependency:

   ```gradle
   dependencies {
     implementation("com.pingidentity.sdks:logger:2.0.0")
   }
   ```

|   |                                                                        |
| - | ---------------------------------------------------------------------- |
|   | Remember to synchronize your Gradle project after adding dependencies. |

### Step 2. Defining and using custom loggers

To create a custom logger, first define a class and override each of the logger methods with the new behavior.

For example, the following code creates a custom logger named `WARN_ERROR_ONLY`, that only outputs warning and error messages, and ignores both info and debug messages:

Defining a custom logger class on Android

```kotlin
import com.pingidentity.logger.Logger.Companion.logger

open class WarnErrorOnlyLogger : Logger {

    override fun d(message: String) {
    }

    override fun i(message: String) {
    }

    override fun w(message: String, throwable: Throwable?) {
        println("$message: $throwable")
    }

    override fun e(message: String, throwable: Throwable?) {
        println("$message: $throwable")
    }
}

val Logger.Companion.WARN_ERROR_ONLY: Logger by lazy {
    WarnErrorOnlyLogger()
}
```

To use the custom logger in your app, specify the logger's name, just as with the preset loggers:

Using a custom logger for the Journey module on Android

```kotlin
val journey = Journey {
  logger = WARN_ERROR_ONLY
  serverUrl = "https://openam-forgerock-sdks.forgeblocks.com/am"
  realm = "alpha"
  cookie = "ch15fefc5407912"
}
```
