diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/annotations/internal/LegacyArchitectureLogger.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/annotations/internal/LegacyArchitectureLogger.kt index f5d20bf2265..faf71095237 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/annotations/internal/LegacyArchitectureLogger.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/annotations/internal/LegacyArchitectureLogger.kt @@ -83,14 +83,20 @@ public object LegacyArchitectureLogger { name: String, logLevel: LegacyArchitectureLogLevel = LegacyArchitectureLogLevel.WARNING ) { - when (logLevel) { - LegacyArchitectureLogLevel.ERROR -> { - throw AssertionException("$name $exceptionMessage") - } - LegacyArchitectureLogLevel.WARNING -> { - ReactSoftExceptionLogger.logSoftException( - ReactSoftExceptionLogger.Categories.SOFT_ASSERTIONS, - ReactNoCrashSoftException("$name $exceptionMessage")) + // Assert is being reported only in DEBUG mode to prevent over logging in production while we + // we are working on decoupling legacy / new architecture. + // Long term the assert will be executed in production and debug environments. + if (ReactBuildConfig.DEBUG) { + when (logLevel) { + LegacyArchitectureLogLevel.ERROR -> { + throw AssertionException("$name $exceptionMessage") + } + + LegacyArchitectureLogLevel.WARNING -> { + ReactSoftExceptionLogger.logSoftException( + ReactSoftExceptionLogger.Categories.SOFT_ASSERTIONS, + ReactNoCrashSoftException("$name $exceptionMessage")) + } } } }