---
title: "Keep personal data out of device logs · Agent Wranglers"
url: https://agentwranglers.se/playbook/mobile-apps/data-on-the-device/no-personal-data-in-device-logs
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Keep personal data out of device logs

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Data on the device](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- ID: MOB-23
- Level: Recommended
- Chapter: [Data on the device](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device)
- Rule: Release builds write no tokens, passwords or personal data to the system log or to log files. Debug logging is compiled out of release builds.
- How: Other tools and crash reports can read the system log. Wrap logging in one helper that drops debug lines in release builds and masks known fields. Crash reports follow the same rule, so scrub breadcrumbs before they leave the phone. The server side rule is [keep personal data out of logs](https://agentwranglers.se/playbook/operations/logs/logs-without-personal-data).
- Check: Run the release build through sign-in and checkout with the device log open. No token, email address or card digits appear.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### Plain text example

```swift
import os
let log = Logger(subsystem: "com.example.fittrack", category: "auth")
log.info("Signed in user \(userId, privacy: .private)")
```

### Kotlin example

```kotlin
object Log {
    fun debug(message: () -> String) {
        if (BuildConfig.DEBUG) android.util.Log.d("FitTrack", message())
    }
}
```

## Sources

- [OWASP MASWE-0005, Insertion of Sensitive Data into Logs](https://mas.owasp.org/MASWE/MASVS-STORAGE/MASWE-0005/)

## Related rules

- [Keep personal data out of logs](https://agentwranglers.se/playbook/operations/logs/logs-without-personal-data) in Operations

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/mobile-apps/data-on-the-device/no-personal-data-in-device-logs">Agent Wranglers mobile apps playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Keep secrets out of device backups](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device/backup-exclusions)
- Next: [Encrypt local data that holds personal data](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device/encrypted-local-data)
- [Data on the device](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device)
