output debug logs to logcat as early as possible on Android
Now that I have a native TorService working on Android, I'm working on creating an Android-native test suite for it. For some reason, it fails to start there, but it fails quite early, so there is no way to get logs out.
--Log debug android is enabled after this issue.
I've gotten earlier log output to logcat by executing
add_android_log() at the beginning of
options_act_reversible(). Ideally, there would be a way to have this built in. On Android, there is no way to see stderr or stdout from C code executed via JNI. Only from Java code. Yes, this is terrible design, but that's how it seems to be.
Here's one potential solution for redirecting stdout/stderr: https://codelab.wordpress.com/2014/11/03/how-to-use-standard-output-streams-for-logging-in-android-apps/ Just ignore the part about Android being "basically a UNIX system" because Android is really not UNIX, its a lot more different from UNIX than Windows. Like Windows, it has some familiar UNIXish things.