Closed
Bug 933291
Opened 12 years ago
Closed 5 years ago
Strip debug/verbose Log calls from release builds with ProGuard
Categories
(Firefox for Android Graveyard :: General, enhancement)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: gcp, Unassigned)
References
Details
Backstory:
The Android documentation about Log:
http://developer.android.com/reference/android/util/Log.html
is actually lying:
http://code.google.com/p/android/issues/detail?id=14015
http://stackoverflow.com/questions/2018263/android-logging
Verbose and Debug Log calls may still exist and output in release builds. Once we get ProGuard set up, we may considering using it to filter them out.
Comment 1•12 years ago
|
||
This is actually rather trivial to implement, you just add the following to proguard.cfg (presumably this'll want to be done with a build flag and an include or such):
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int d(...);
}
Trying it out, it saves us 7kb on apk size. Might be worth further work.
Comment 2•12 years ago
|
||
I'm not sure this is the avenue we really want to take, or the magnitude, for a few reasons:
* The code size reduction isn't much.
* It loses debug logs in release.
* It loses the ability to turn up log.tag.Foo to get better logs.
* It doesn't make it any more efficient for code to make decisions about what to log. (isLoggable is expensive.)
In the Android services tree we use a nice class called Logger; it's the thing that spits out the thread-specific ::-delimited logging output.
One of the things it does is to cache system log levels on first use, so we don't pay a heavy price to check. The only cost to a Loggable.debug() call is then string concatenation; it automatically checks whether your log tag is set to DEBUG. You can ask Logger explicitly if you want to avoid building the log string, and that question is cheap.
If we're concerned by log volume, we should switch the rest of Fennec to use Logger instead of Log.
If we're concerned about (a) computation cost of routine log output, or (b) code size, then yes, we'd need to make the tradeoff of removing the logging code altogether.
Comment 3•5 years ago
|
||
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INCOMPLETE
| Assignee | ||
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•