Fix a crashing issue of Android logging

Avoid using std::cerr.
This patch resolves GitHub issue #38025.

PiperOrigin-RevId: 346452855
Change-Id: Ife2504476b265909814c09c900cbb5090a55fcc5
This commit is contained in:
Terry Heo 2020-12-08 18:15:36 -08:00 committed by TensorFlower Gardener
parent a960cb2c42
commit 2d753e6a21

View File

@ -485,7 +485,8 @@ void TFDefaultLogSink::Send(const TFLogEntry& entry) {
__android_log_write(android_log_level, "native", ss.str().c_str());
// Also log to stderr (for standalone Android apps).
std::cerr << "native : " << ss.str() << std::endl;
// Don't use 'std::cerr' since it crashes on Android.
fprintf(stderr, "native : %s\n", ss.str().c_str());
// Android logging at level FATAL does not terminate execution, so abort()
// is still required to stop the program.