How to get ART in AOSP redirect stdio to logcat?

174 views
Skip to first unread message

satur9nine

unread,
Jan 21, 2021, 11:11:00 AM1/21/21
to android-platform
I want to get stdout and stderr from system_server to show up in logcat since a number of native libraries have no real awareness they are running in Android and I'd like to debug them by examining their logging. From what I can tell by default stdout and stderr are redirected to /dev/null for processes spawned by the zygote in Android. I read that in older android versions you could use:

setprop log.redirect-stdio true

Which set -Xlog-stdio when starting dalvik. Recent Android versions using ART seem to no longer honor this property. Is there an alternative for recent Android versions that use ART?

I tried adding /system/bin/logwrapper to service zygote init command that starts the system server but I get this error:

Could not ctl.start for 'zygote': File /system/bin/logwrapper(labeled "u:object_r:system_file:s0") has incorrect label or no domain transition from u:r:init:s0 to another SELinux domain defined. Have you configured your service correctly? https://source.android.com/security/selinux/device-policy#label_new_services_and_address_denials

This error appears even if I disable SELinux with setenforce 0. Perhaps there is some other mechanism in ART I'm not aware of?

Thanks,
Jacob

Reply all
Reply to author
Forward
0 new messages