logs · deviceLogs
This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET
Read a log: the current WebView's console, or the device's own log (logcat on Android, the unified log on an iOS simulator, and on a real iPhone what the session has captured since it started — a phone keeps no history). These call app_logs.
logs
public List<Map<String, Object>> logs()
Console output from the current WebView since the last call, including uncaught errors and unhandled promise rejections. Each read drains what it returns, so it reports what happened since the last call. Capture starts when the context is entered, so a page's initial load is already over by then.
@return each console entry since the last call
deviceLogs
public Map<String, Object> deviceLogs(String app, String level, int lines)
The device's own log since the last read: logcat on Android, the
unified log on an iOS simulator, what a real iPhone's session has captured. The map has entries — each with
time, level, tag, pid and message — and skipped, lines newer than
the last read that the limit dropped, which will not come back. The
first read returns the most recent lines. Pass null or zero to leave a
filter unset.
@param app only this app's lines, or null for every app
@param level the lowest level to include, or null for every level
@param lines the most lines to return, or 0 for the default
@return the lines under entries, and how many were skipped
Examples
Read one app's errors from the device log
Map<String, Object> log = device.deviceLogs("com.example.shop", "error", 0); // 0: the default line limit
System.out.println(log.get("entries"));