Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Android
  3. LoggingInterceptor

LoggingInterceptor

MITKotlin4.0.0

An OkHttp interceptor with a pretty logger for Android HTTP requests and responses, including mock support.

GitHubGitHub
1.4k stars122 forks0 contributors

What is LoggingInterceptor?

LoggingInterceptor is an OkHttp3 interceptor library for Android that logs HTTP request and response details in a formatted, readable way. It solves the problem of debugging network calls by providing structured logs with configurable detail levels and built-in mock support for development.

Target Audience

Android developers using OkHttp for network requests who need to debug API calls, inspect HTTP traffic, or mock responses during app development.

Value Proposition

Developers choose LoggingInterceptor for its clean, customizable logging output, mock API capabilities, and seamless integration with OkHttp, making network debugging faster and more efficient than manual logging or basic OkHttp logging.

Overview

An OkHttp interceptor which has pretty logger for request and response. +Mock support

Use Cases

Best For

  • Debugging HTTP requests and responses in Android apps
  • Mocking API responses during development or testing
  • Formatting network logs for better readability in Logcat
  • Adding custom headers or query parameters to OkHttp requests
  • Avoiding log interleaving with batched logging sinks
  • Controlling log detail levels (e.g., body, headers, basic) for network calls

Not Ideal For

  • Projects not using OkHttp3 on Android, as it's tightly coupled to this stack and won't work with other HTTP clients or platforms.
  • Production applications where minimizing logging overhead is critical, as detailed request/response logging can impact performance and expose sensitive data.
  • Teams needing server-side or cross-platform logging solutions, since it relies on Android's Logcat and lacks built-in support for remote log aggregation.

Pros & Cons

Pros

Human-Readable Logs

Formats HTTP request and response data into structured, easy-to-read Logcat output, making network debugging faster and more intuitive.

Built-in Mock Support

Enables mocking API responses with custom JSON via a BufferListener, allowing development without a live backend for testing.

Flexible Log Levels

Supports NONE, BASIC, HEADERS, and BODY levels to control log detail, giving developers fine-grained control over what is logged.

Batching for Logcat

With custom sinks like BatchingSink, logs can be batched to avoid interleaving in Logcat, improving readability in multi-threaded scenarios.

Cons

Dependency Conflicts

Requires excluding the 'org.json' module in Gradle to avoid conflicts, which can be cumbersome and error-prone in complex projects.

Logcat Truncation Issues

Tied to Android's Logcat, which truncates lines at ~4k characters, necessitating custom chunking for large HTTP bodies as noted in the README.

Mock Setup Complexity

Enabling mock support requires implementing a BufferListener and managing JSON files manually, adding initial setup overhead compared to simpler tools.

Frequently Asked Questions

Quick Stats

Stars1,352
Forks122
Contributors0
Open Issues0
Last commit2 months ago
CreatedSince 2017

Tags

#java-library#network-debugging#okhttp#android#logging-library#java#mock#mock-api#development-tools#kotlin#http-logging#mocking-framework

Built With

K
Kotlin
J
Java

Included in

Android12.0k
Auto-fetched 7 minutes ago

Related Projects

loggerlogger

✔️ Simple, pretty and powerful logger for android

Stars13,863
Forks2,135
Last commit3 years ago
timbertimber

A logger with a small, extensible API which provides utility on top of Android's normal Log class.

Stars10,814
Forks985
Last commit2 days ago
Logback AndroidLogback Android

📄The reliable, generic, fast and flexible logging framework for Android

Stars1,260
Forks181
Last commit28 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub