Learn how to view logs when using Expo CLI, native logs in Android Studio and Xcode, and system logs.
Logging information in a React Native app works similarly to in a web browser. You can use
console.error. However, at times, you might want to dive deep to get more useful information about what's happening in your app. For that, you can use native logs and system logs.
When you run
npx expo start and connect a device, console logs will show up in the terminal process. These logs are sent from the runtime to Expo CLI over web sockets, meaning the results are lower fidelity than connecting dev tools directly to the engine.
You can view native runtime logs in Android Studio and Xcode by compiling the native app locally. For more information, see native debugging.
While it's usually not necessary, if you want to see logs for everything happening on your device, for example, even the logs from other apps and the OS, you can use the following commands:
# Show system logs for an Android device with adb logcat
npx react-native log-android
# Show system logs for an iOS device
npx react-native log-ios