Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't enable logs on Android #10624

Closed
alopatindev opened this issue Apr 15, 2016 · 1 comment
Closed

Can't enable logs on Android #10624

alopatindev opened this issue Apr 15, 2016 · 1 comment
Labels

Comments

@alopatindev
Copy link
Contributor

@alopatindev alopatindev commented Apr 15, 2016

I was trying to apply something like RUST_LOGS=debug on Android (debug) build without success.

Is this doc outdated? The first doubt was that the change might should be in main.rs not main.cpp

Trying this

diff --git a/components/servo/main.rs b/components/servo/main.rs
index 08ed645..64598d5 100644
--- a/components/servo/main.rs
+++ b/components/servo/main.rs
@@ -194,9 +194,9 @@ mod android {

     pub fn setup_logging() {
         use self::libc::{STDERR_FILENO, STDOUT_FILENO};
-        //use std::env;
+        use std::env;

-        //env::set_var("RUST_LOG", "servo,gfx,msg,util,layers,js,std,rt,extra");
+        env::set_var("RUST_LOG", "debug");
         redirect_output(STDERR_FILENO);
         redirect_output(STDOUT_FILENO);

—nothing changes, still none of info!, debug! or println! printing anything to adb logcat.

Calling android_glue::write_log directly doesn't print anything either. Because it calls __android_log_write with hardcoded log level 3 (ANDROID_LOG_DEBUG) that never worked for me (because "Debug logs are compiled in but stripped at runtime") even with android:debuggable="true".

Changing it to 4 the direct call of android_glue::write_log is working but still info!, debug! and println! are not printing anything.

Does it work for anyone? How and on which device? Thanks!

P.S.: initially I wanted to enable logging on release builds (is that possible either?), so that profiling thing could work. That would probably help to solve issues #7221 and #7211

@jdm jdm added the P-android label Apr 15, 2016
@fabricedesre
Copy link
Contributor

@fabricedesre fabricedesre commented Feb 25, 2017

Closing as env::set_var("RUST_LOG", "debug"); is now the default on android and logs are redirected to logcat properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.