Documentation Index Fetch the complete documentation index at: https://mintlify.com/facebook/react-native/llms.txt
Use this file to discover all available pages before exploring further.
Learn how to view logs from Android devices and emulators for debugging React Native applications.
Overview
Android logging is handled through adb logcat, which displays system and application logs from connected Android devices and emulators.
Usage
Basic Logcat
Displays all system logs (very verbose).
Filter React Native Logs
adb logcat * :S ReactNative:V ReactNativeJS:V
Shows only React Native-related logs.
Your App’s Logs
adb logcat | grep "$( adb shell ps | grep com.yourapp | awk '{print $2}')"
Filter logs from your specific app.
Common Filters
By Tag
# React Native JavaScript logs
adb logcat -s ReactNativeJS
# Native module logs
adb logcat -s ReactNative
# Custom tag
adb logcat -s YourCustomTag
By Priority
# Error and above
adb logcat * :E
# Warning and above
adb logcat * :W
# Info and above
adb logcat * :I
# Debug and above
adb logcat * :D
# Verbose (all)
adb logcat * :V
Priority levels (lowest to highest):
V - Verbose
D - Debug
I - Info
W - Warning
E - Error
F - Fatal
S - Silent (suppress all)
Multiple Filters
adb logcat ReactNative:V ReactNativeJS:V * :S
Show ReactNative and ReactNativeJS at Verbose level, suppress everything else.
Brief (Default)
Output:
I/ReactNativeJS(12345): 'Hello from JavaScript!'
Time
Output:
01-23 12:34:56.789 I/ReactNativeJS(12345): 'Hello from JavaScript!'
Threadtime
Output:
01-23 12:34:56.789 12345 12678 I ReactNativeJS: 'Hello from JavaScript!'
Long
Most detailed format with full metadata.
Useful Commands
Clear Logs
Clears the log buffer.
Save to File
adb logcat -d > android-logs.txt
Follow Logs in Real-Time
adb logcat -v time | grep ReactNative
Last 100 Lines
Colored Output
Use pidcat for colored, filtered logs:
# Install pidcat
brew install pidcat # macOS
# Or
pip install pidcat
# Use pidcat
pidcat com.yourapp
JavaScript Console Logs
console.log()
console . log ( 'Hello from JS!' );
Appears as:
I/ReactNativeJS: 'Hello from JS!'
console.warn()
console . warn ( 'This is a warning' );
Appears in logs and shows yellow box in app.
console.error()
console . error ( 'This is an error' );
Appears in logs and shows red screen in app.
console.debug()
console . debug ( 'Debug information' );
Native Module Logs
Android Log API
In native Android code:
import android.util.Log;
public class MyModule {
private static final String TAG = "MyModule" ;
public void myMethod () {
Log . d (TAG, "Debug message" );
Log . i (TAG, "Info message" );
Log . w (TAG, "Warning message" );
Log . e (TAG, "Error message" );
}
}
View these logs:
React Native Bridge
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactApplicationContext;
ReactContext reactContext = getReactApplicationContext ();
reactContext . getJSModule ( DeviceEventManagerModule . RCTDeviceEventEmitter . class )
. emit ( "eventName" , data);
Filtering Techniques
Grep Patterns
# Case insensitive
adb logcat | grep -i "error"
# Multiple patterns
adb logcat | grep -E "error|warning"
# Exclude patterns
adb logcat | grep -v "noise"
By Process ID
# Get PID
adb shell ps | grep com.yourapp
# Filter by PID
adb logcat --pid=12345
By Package
adb logcat --pid=$( adb shell pidof -s com.yourapp )
Multiple Devices
List Devices
Output:
List of devices attached
emulator-5554 device
3FEDA8BC0 device
Target Specific Device
# By serial
adb -s emulator-5554 logcat
# By transport
adb -e logcat # Emulator
adb -d logcat # USB device
Advanced Filtering
Custom Filter Script
Create filter-logs.sh:
#!/bin/bash
adb logcat -v time | grep --line-buffered -E "ReactNative|ReactNativeJS| $1 " | \
grep --line-buffered -v "noise"
Use:
chmod +x filter-logs.sh
./filter-logs.sh MyTag
Color-coded Grep
adb logcat | grep --color=always -E "E/|W/|I/"
Memory Logs
CPU and Threading
adb logcat -s ActivityManager
Crashes
adb logcat -s AndroidRuntime
Network
adb logcat -s NetworkScheduler:V
Crash Debugging
View Stack Traces
adb logcat -s AndroidRuntime:E
After Crash
adb logcat -d > crash-log.txt
Saves entire log buffer including crash information.
Native Crashes
Shows native crash information and stack traces.
Integration with Development
React Native CLI
When running:
npx react-native run-android
Logs automatically appear in the terminal.
Metro Bundler
When running:
JavaScript logs appear in Metro terminal window.
Separate Log Window
# Terminal 1: Metro
npx react-native start
# Terminal 2: App
npx react-native run-android
# Terminal 3: Filtered logs
adb logcat -s ReactNativeJS
React Native Debugger
Standalone app with integrated Chrome DevTools:
brew install --cask react-native-debugger
Provides:
Console logs
Network inspector
Redux DevTools
React DevTools
Flipper
Desktop debugging platform:
brew install --cask flipper
Features:
Logs viewer
Network inspector
Layout inspector
Database viewer
Open developer menu (Cmd+M or Ctrl+M)
Select “Debug”
Open Chrome DevTools
View Console tab
Log Management
Rotate Logs
# Set buffer size (in KB)
adb logcat -G 16M
# View buffer size
adb logcat -g
Multiple Buffers
# Main buffer (default)
adb logcat -b main
# System buffer
adb logcat -b system
# Events buffer
adb logcat -b events
# Crash buffer
adb logcat -b crash
# All buffers
adb logcat -b all
Troubleshooting
No Logs Appearing
Solution:
Check device connection:
Restart ADB:
adb kill-server
adb start-server
Check log buffers:
Too Much Noise
Solution:
Use more specific filters:
adb logcat ReactNativeJS:V * :S
Logs Cut Off
Solution:
Increase buffer size:
Can’t Find App Logs
Solution:
Verify app package name:
adb shell pm list packages | grep yourapp
Then filter:
adb logcat | grep com.yourapp
Best Practices
Use Appropriate Log Levels
Use console.log() for general information
Use console.warn() for warnings
Use console.error() for errors
Use console.debug() for verbose debugging
Always use descriptive tags in native code: private static final String TAG = "MyFeature" ;
Log . d (TAG, "Clear description" );
Remove or disable verbose logging before production: if ( __DEV__ ) {
console . log ( 'Debug info' );
}
Next Steps
Run Android Build and run your Android app
iOS Logs View iOS device logs
Debugging Complete debugging guide
Troubleshooting Common issues and solutions