When we run proguard on the following piece of Code it should remove the Logging statment:
Log.d(TAG, "field= "+field+“ : enhancedfield=”+enhancedfield);
But... After compilation you will see this:
Log.d(TAG, new StringBuilder().append("Field= ").append(field)
.append(“ : enhancedfield=”).append(enhancedfield).toString());
Now when we run proguard on this, you will get some leftovers:
new StringBuilder().append("Field= ").append(field)
.append(“ : enhancedfield=”).append(enhancedfield).toString();
This leaks info to pottential hackers...
What can i do:
Declare a final static boolean
and only log when the value is true
. Because this value can be determined at compile time, the logging code will not be included when the value is false. But that polutes my code, so i am not that happy with that.
Now my Question: How can i improve this behavior? leaving less leftovers and leaking less information?