# Debugging with HTTPS Logs

Updated 2 months ago  
by  
Kashif Hussain

Sofy allows you to capture and analyze **network activity** during your test sessions. This helps debug app behavior by surfacing **exact network requests and responses**, making it easier to spot connectivity issues and validate backend interactions, to ensure your application is communicating as expected.

### How to Capture HTTPS Logs

1. **Acquire a Device**  
   1. Log in to your Sofy account.  
   2. Select **Device Lab** from the left navigation bar.  
     
   3. Locate the device you want to test, then select **Acquire**.  
     
   4. Click **Launch** to open the device in a new window.  
     
2. **Start Logging**  
   - From the device toolbar, click on **the Play icon next to HTTPS logs**  
     
   - If your application has been enabled to allow HTTPS recording (see the Chucker Integration section below), you will be able to stream the logs as well as download them.

### Capturing API Logs Using Chucker (Android)

To enable real-time API (HTTPS) logging in Sofy, your Android app must integrate the Chucker HTTP inspector.

**How it works**  
- Sofy pulls Chucker’s local database from the device via ADB  
- Extracts new API transactions incrementally  
- Streams logs as JSON in real time during lab sessions  
- Stops automatically when the session ends

### Setup Steps

**1\. Add Chucker Dependency**  
- Use full Chucker in debug builds and no-op in release builds to avoid exposing logs to end users

**2\. Attach Chucker to Your Network Layer**  
- Add Chucker as an interceptor to your OkHttp client (used by Retrofit/Ktor as well)

**3\. Ensure Debuggable Build**  
- Your app must be built with `debuggable = true` so Sofy can access logs via ADB

### Required Configuration

- Database must exist at: `databases/chucker.db`  
- Associated WAL/SHM files must also be present  
- Table name must be: `transactions`  
- App must allow `run-as` access (debug builds only)

### Verification (Recommended)

Run the following to confirm setup:

```kotlin
adb -s <deviceId> exec-out run-as <package> ls databases/
```

You should see:
- `chucker.db`  
- `chucker.db-wal`  
- `chucker.db-shm`

### When to Use This

- Debug API failures or unexpected responses  
- Validate request/response payloads  
- Gain visibility into app-server communication

### Key Notes

- Works only for traffic captured inside the app (before encryption)  
- Required for readable HTTPS/API logs (PCAP alone won’t show payloads)  
- May require additional setup for non-native Android frameworks

* * *
