---
title: "Logging"
canonical_url: "https://www.nutrient.io/guides/android/features/logging/"
md_url: "https://www.nutrient.io/guides/android/features/logging.md"
last_updated: "2026-06-09T10:22:07.535Z"
description: "Configure Android logging using the PdfLog API: add custom loggers with addLogger(), control log output destinations, and filter messages based on priority (e.g. VERBOSE, INFO) or tag via the Logger#isLogged() method."
---

Nutrient Android SDK logs important debugging information via the [`PdfLog`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/index.html) API. [`PdfLog`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/index.html) allows you to log messages in your app and inject your own [loggers](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/-logger/index.html) to implement a custom logging policy. The default logger logs messages with a priority of `INFO` and higher to the system Logcat.

## Custom loggers

[`PdfLog`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/index.html) manages a list of [loggers](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/-logger/index.html) that handle log filtering and log output. All logged messages are delegated to these loggers in the order of their registration.

A list of loggers can be managed with the static methods defined in [`PdfLog`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/index.html). You can add your own loggers with the [`addLogger()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/add-logger.html) method, remove existing loggers with [`removeLogger()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/remove-logger.html), or replace existing loggers with [`setLoggers()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/set-loggers.html). Note that it’s best to add your custom loggers early on to catch all logs.

### Filtering logs

Logs can be filtered based on their priority (`VERBOSE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, and `ASSERT`) and tag. To do this, override the default interface method, [`Logger#isLogged()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/-logger/is-logged.html), in your custom loggers:

### KOTLIN

```kotlin

class CustomLogger : PdfLog.Logger {

    override fun isLogged(@PdfLog.LogPriority priority: Int, tag: String): Boolean {
        // This method is called for each log message.
        // Return `true` for logs that should be logged, and return `false` for logs that should be ignored.
        // If you return `false`, the `log()` method below won't be called for this log message.
        return priority >= Log.INFO;
    }

    override fun log(@PdfLog.LogPriority priority: Int, tag: String, message: String, throwable: Throwable?) {
        // Implement your custom logging here....
    }
}

```

### JAVA

```java

public class CustomLogger implements PdfLog.Logger {

    @Override
    public boolean isLogged(int priority, @NonNull String tag) {
        // This method is called for each log message.
        // Return `true` for logs that should be logged, and return `false` for logs that should be ignored.
        // If you return `false`, the `log()` method below won't be called for this log message.
        return priority >= Log.INFO;
    }

    @Override
    public void log(@PdfLog.LogPriority int priority, @NonNull String tag, @NonNull String message, @Nullable Throwable throwable) {
        // Implement your custom logging here....
    }
}

```

### Custom logging

Each [`Logger`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/-logger/index.html) must implement its [`log()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/-logger/log.html) method to output log messages to the destination of their choice — for example, Logcat, a text file, a database, or a third-party logging library.

## Disabling logging

Logging can be easily disabled by removing all registered loggers via [`PdfLog#removeAllLoggers()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/remove-all-loggers.html):

### KOTLIN

```kotlin

PdfLog.removeAllLoggers()

```

### JAVA

```java

PdfLog.removeAllLoggers();

```

## ProGuard

We strongly recommend stripping all log statements from your release application by using the following ProGuard rule:

```text

# Remove all Android logging calls that should be ignored in release builds to prevent logs in Logcat.

-assumenosideeffects class android.util.Log {
    public static int v(...);
    public static int d(...);
    public static int i(...);
    public static int w(...);
    public static int e(...);
}

```

Nutrient logging calls ([`PdfLog`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/index.html)) should be kept, as they can be stored in a file or sent to a third-party crash reporting tool by configuring a custom [`Logger`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.utils/-pdf-log/-logger/index.html).
---

## Related pages

- [About Memory Usage](/guides/android/memory-and-storage/about-memory-usage.md)
- [Check For Compatibility](/guides/android/faq/check-for-compatibility.md)
- [Customizing The Page Number](/guides/android/customizing-pdf-pages/customizing-the-page-number.md)
- [Framework Size](/guides/android/faq/framework-size.md)
- [Managing data storage and privacy in Android](/guides/android/best-practices/data-storage-and-privacy.md)
- [Manual Library Integration](/guides/android/advanced-integration/manual-library-integration.md)
- [Nightly Builds](/guides/android/advanced-integration/nightly-builds.md)
- [Opening Local Files](/guides/android/miscellaneous/opening-local-files.md)
- [Permissions](/guides/android/advanced-integration/permissions.md)
- [Optimize Pdf Documents For Mobile Rendering](/guides/android/miscellaneous/optimize-pdf-documents-for-mobile-rendering.md)
- [Powered By Nutrient](/guides/android/miscellaneous/powered-by-nutrient.md)
- [Android PDF SDK security](/guides/android/faq/sdk-security.md)
- [Subscription Validation](/guides/android/announcements/subscription-validation.md)
- [Unsupported Internal Symbols](/guides/android/announcements/unsupported-internal-symbols.md)
- [Third Party Compatibility](/guides/android/miscellaneous/third-party-compatibility.md)

