Daniel
Daniel

Reputation: 1729

Are Log messages and System.out.println calls visible once an Android app is published?

I have many calls to Log.d() and System.out.println(), which I have used for debugging, in my Android application. Are these log messages still visible to anyone who runs the production apk?

Upvotes: 2

Views: 317

Answers (4)

usajnf
usajnf

Reputation: 522

Yes they are. They are indeed.

Upvotes: 1

Linh
Linh

Reputation: 60973

All Log messages still visible to anyone who runs the production apk so you can create a custom class for print all the Log

public class MyLog {
     public final boolean ENABLE_LOG = true; // or ENABLE_LOG = BuildConfig.DEBUG

     public static void d(String tag, String msg) {
        if (ENABLE_LOG){
            Log.d(tag, msg);
        } 
     }
     public static void e(String tag, String msg){
        ...
     } 
     ...
}

and use

 MyLog.d("TAG","test"); // instead of Log.d("TAG","test")

Upvotes: 1

Jayakrishnan
Jayakrishnan

Reputation: 4667

Yes. it is visible to others and retrievable using tools. You can pro grammatically check if it is in debug mode by following code,

 if (BuildConfig.DEBUG) {
    Log.d(TAG, "xxxx");
 }

Thank you

Upvotes: 1

Anton Tananaev
Anton Tananaev

Reputation: 2523

Yes, all log messages are still logged into standard Android logcat, even in release builds.

Upvotes: 1

Related Questions