axiom-xclog-ref
Original:🇺🇸 English
Translated
Use when capturing iOS simulator console output, diagnosing runtime crashes, viewing print/os_log output, or needing structured app logs for analysis. Reference for xclog CLI covering launch, attach, list modes with JSON output.
2installs
Sourcecharleswiltgen/axiom
Added on
NPX Install
npx skill4agent add charleswiltgen/axiom axiom-xclog-refTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →xclog Reference (iOS Simulator Console Capture)
xclog captures iOS simulator console output by combining (print/debugPrint/NSLog) with (os_log/Logger). Single binary, no dependencies.
simctl launch --consolelog stream --style jsonBinary Location
bash
${CLAUDE_PLUGIN_ROOT}/bin/xclogWhen to Use
- Runtime crashes — capture what the app logged before crashing
- Silent failures — network calls, data operations that fail without UI feedback
- Debugging print() output — see what the app is printing to stdout/stderr
- os_log analysis — structured logging with subsystem, category, and level filtering
- Automated log capture — and
--timeoutfor bounded collection--max-lines
Critical Best Practices
Check first. If no saved preferences, run before to discover the correct bundle ID.
.axiom/preferences.yamllistlaunchApp already running? will terminate it and relaunch. Use if you need to preserve current state (os_log only — no print() capture).
launchattachbash
# 1. FIRST: Check .axiom/preferences.yaml for saved device and bundle ID
# 2. If no preferences: Discover installed apps
${CLAUDE_PLUGIN_ROOT}/bin/xclog list
# 3. Find the target app's bundle_id from output
# 4. THEN: Launch with the correct bundle ID (restarts app)
${CLAUDE_PLUGIN_ROOT}/bin/xclog launch com.example.MyApp --timeout 30s --max-lines 200
# OR: Attach to running app without restarting (os_log only)
${CLAUDE_PLUGIN_ROOT}/bin/xclog attach MyApp --timeout 30s --max-lines 200Preferences
Axiom saves simulator preferences to in the project root. Check this file before running — if preferences exist, use the saved device and bundle ID directly.
.axiom/preferences.yamlxclog listReading Preferences
Before running , read :
xclog list.axiom/preferences.yamlyaml
simulator:
device: iPhone 16 Pro
deviceUDID: 1A2B3C4D-5E6F-7890-ABCD-EF1234567890
bundleId: com.example.MyAppIf the file exists and contains a section, use the saved and for xclog commands. Skip unless the user asks for a different app or the saved values fail.
simulatordeviceUDIDbundleIdxclog listbash
${CLAUDE_PLUGIN_ROOT}/bin/xclog launch <bundleId> --device <deviceUDID> --timeout 30s --max-lines 200If the file doesn't exist or the section is missing, fall back to discovery.
simulatorxclog listIf the saved is not found among available simulators (xclog or simctl fails), fall back to discovery and save the new selection.
deviceUDIDIf the YAML is malformed, warn the developer and fall back to discovery. Do not overwrite a malformed file.
Writing Preferences
After a successful or when the user selects a target app from output, save the device and bundle ID:
xclog launchxclog list- If doesn't exist, create it. Then check
.axiom/: if the file exists, check if any line matches.gitignoreexactly — if not, append.axiom/on a new line. If.axiom/doesn't exist, create it with.gitignoreas its content..axiom/ - Read if it exists (to preserve other keys)
.axiom/preferences.yaml - Update the section with
simulator:,device, anddeviceUDIDbundleId - Write the merged YAML back using the Write tool
Write the same structure shown in Reading Preferences above.
simulator:Commands
list — Discover Installed Apps
bash
${CLAUDE_PLUGIN_ROOT}/bin/xclog list
${CLAUDE_PLUGIN_ROOT}/bin/xclog list --device <udid>Output (JSON lines):
json
{"bundle_id":"com.example.MyApp","name":"MyApp","version":"1.2.0"}
{"bundle_id":"com.apple.mobilesafari","name":"Safari","version":"18.0"}launch — Full Console Capture
Launches the app and captures ALL output: print(), debugPrint(), NSLog(), os_log(), Logger.
bash
# Basic launch (JSON output, runs until app exits or Ctrl-C)
${CLAUDE_PLUGIN_ROOT}/bin/xclog launch com.example.MyApp
# Bounded capture (recommended for LLM use)
${CLAUDE_PLUGIN_ROOT}/bin/xclog launch com.example.MyApp --timeout 30s --max-lines 200
# Filter by subsystem
${CLAUDE_PLUGIN_ROOT}/bin/xclog launch com.example.MyApp --subsystem com.example.MyApp.networking
# Filter by regex
${CLAUDE_PLUGIN_ROOT}/bin/xclog launch com.example.MyApp --filter "error|warning|crash"
# Save to file
${CLAUDE_PLUGIN_ROOT}/bin/xclog launch com.example.MyApp --output /tmp/console.log --timeout 60sattach — Monitor Running Process
Attaches to a running process via os_log only. Does NOT capture print()/debugPrint(). Simulator only.
bash
# By process name
${CLAUDE_PLUGIN_ROOT}/bin/xclog attach MyApp --timeout 30s
# By PID
${CLAUDE_PLUGIN_ROOT}/bin/xclog attach 12345 --max-lines 100
# Filter for errors only
${CLAUDE_PLUGIN_ROOT}/bin/xclog attach MyApp --filter "(?i)error|fault"show — Historical Log Search (Simulator + Physical Device)
Searches recent logs without needing proactive capture. Works with both simulator and connected physical devices.
bash
# Simulator: show last 5 minutes of MyApp logs
${CLAUDE_PLUGIN_ROOT}/bin/xclog show MyApp --last 5m --max-lines 200
# Simulator: show last 10 minutes, errors only
${CLAUDE_PLUGIN_ROOT}/bin/xclog show MyApp --last 10m --max-lines 100 --filter "(?i)error|fault"
# Physical device: collect and show logs (device must be connected + unlocked)
${CLAUDE_PLUGIN_ROOT}/bin/xclog show MyApp --device-udid 00008101-... --last 5m --max-lines 200
# By PID
${CLAUDE_PLUGIN_ROOT}/bin/xclog show 12345 --last 2mPhysical device workflow: runs to pull a log archive from the device over USB, then parses it locally. The device must be connected and unlocked.
show --device-udidlog collectWhen to use vs :
showattach- — "What just happened?" (post-mortem, no setup needed)
show - — "What's happening now?" (live streaming, must be running before the event)
attach
Output Format
Default output is JSON lines (one JSON object per line).
JSON Schema (Default)
json
{
"time": "10:30:45.123",
"source": "os_log",
"level": "error",
"subsystem": "com.example.MyApp",
"category": "networking",
"process": "MyApp",
"pid": 12345,
"text": "Connection failed: timeout"
}| Field | Type | Present | Description |
|---|---|---|---|
| time | string | Always | HH:MM:SS.mmm timestamp |
| source | string | Always | |
| level | string | os_log only | |
| subsystem | string | os_log only | Reverse-DNS subsystem (e.g. |
| category | string | os_log only | Log category within subsystem |
| process | string | os_log only | Process binary name |
| pid | int | os_log only | Process ID |
| text | string | Always | The log message content |
Fields not applicable to a source are omitted (not null).
Human-Readable Mode
bash
${CLAUDE_PLUGIN_ROOT}/bin/xclog attach MyApp --human
${CLAUDE_PLUGIN_ROOT}/bin/xclog attach MyApp --human --no-colorOptions Reference
| Option | Default | Description |
|---|---|---|
| | Target simulator UDID |
| none | Physical device UDID (show command) |
| stdout | Also write to file |
| off | Human-readable colored output |
| off | Disable ANSI colors (--human mode) |
| none | Filter lines by Go regex |
| none | Filter os_log by subsystem |
| 0 (unlimited) | Stop after n lines |
| 0 (unlimited) | Stop after duration (e.g. |
| | How far back to search (show command) |
Coverage by Source
| Swift API | launch | attach | show |
|---|---|---|---|
| yes | no | no |
| yes | no | no |
| yes | yes | yes |
| yes | yes | yes |
| yes | yes | yes |
| Simulator | Physical Device | |
|---|---|---|
| yes | no |
| yes | no |
| yes | yes |
| yes | yes |
Use for full coverage. is for monitoring already-running processes.
launchattachNote: terminates any existing instance of the app before relaunching. If the app is already running and you don't want to restart it, use (os_log only).
launchattachError Behavior
xclog prints errors to stderr and exits with code 1. Common errors:
| Error | Cause | Fix |
|---|---|---|
| Bad bundle ID or no booted simulator | Run |
| App failed to launch | Check the app builds and runs in the simulator |
| Bad | Check Go regex syntax (similar to RE2) |
| Subsystem contains spaces or special characters | Use reverse-DNS format: |
Interpreting Output
Filtering by Level
os_log levels indicate severity. For crash diagnosis, focus on and .
errorfaultNote: matches against the message text, not the JSON output. To filter by level, use jq:
--filterbash
${CLAUDE_PLUGIN_ROOT}/bin/xclog launch com.example.MyApp --timeout 30s 2>/dev/null | jq -c 'select(.level == "error" or .level == "fault")'For text-based filtering, works on message content:
--filterbash
# Filter messages containing "error" or "failed" (case-insensitive)
${CLAUDE_PLUGIN_ROOT}/bin/xclog launch com.example.MyApp --filter "(?i)error|failed"Common Subsystem Patterns
| Subsystem | What it indicates |
|---|---|
| URLSession / networking layer |
| Core Data / persistence |
| SwiftUI framework |
| UIKit framework |
| App's own subsystem | Application-level logging |
Workflow: Diagnose a Runtime Crash
- → find bundle ID
xclog list - → start capture (this restarts the app — expected)
xclog launch <bundle-id> --timeout 60s --max-lines 500 --output /tmp/crash.log - Reproduce the crash in the simulator
- Read and filter for errors:
/tmp/crash.logjq 'select(.level == "error" or .level == "fault")' /tmp/crash.log - Check the last few lines before the stream ended (crash point)
If the crash is intermittent, increase bounds: and repeat.
--timeout 120s --max-lines 1000Workflow: Investigate Silent Failure
xclog launch <bundle-id> --subsystem com.example.MyApp --timeout 30s- Trigger the failing operation
- Look for error-level messages in the app's subsystem
- Cross-reference with network or data subsystems if app logs are silent
Resources
Skills: axiom-xcode-debugging, axiom-performance-profiling, axiom-lldb