I have following code c++ code:
static void print_string(JNIEnv * env, jclass clazz, jstring str){
jboolean isCopy;
const char* utf_string;
utf_string = env->GetStringUTFChars(str, &isCopy);
env->ReleaseStringUTFChars(str, utf_string);
//LOGI("%s",utf_string);
// LOGE("JNI Out = %s", utf_string);
printf("jni out: %s",utf_string);
__android_log_print(ANDROID_LOG_INFO, "MyTag", "The value is %s", utf_string);
env->ReleaseStringUTFChars(str, utf_string);
}
I don't see any output in logcat. So where does it goes? How can I see it?
Accordint to the docs the output is lost:
By default, the Android system sends
stdout
andstderr
(System.out
andSystem.err
) output to/dev/null
.
There are methods to change that (on rooted devices), for example using setprop
, taken from the docs:
$ adb shell stop
$ adb shell setprop log.redirect-stdio true
$ adb shell start
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With