Closed
Bug 1263338
Opened 9 years ago
Closed 4 years ago
Investigate removing unnecessary logging from Java code
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(firefox48 affected)
RESOLVED
INCOMPLETE
Tracking | Status | |
---|---|---|
firefox48 | --- | affected |
People
(Reporter: rnewman, Unassigned)
References
Details
(There's probably an old bug on this, but here, have a new one.)
Every RuntimeException string, and every log message (Log.{d,e,v,i}, is compiled into classes.dex. Furthermore, each logging call adds bytecode.
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
1756: Log.d(LOGTAG, "Enabling Android StrictMode");
$ strings classes.dex| fgrep Enabling
Enabling Android StrictMode
As Nathan notes in Bug 1263197, this adds to our APK size. Presumably not as much as Gecko's logging does (900KB in libxul!), but it would be worth revisiting.
There are three parts to this bug:
1. Deleting code. Some logging no longer adds value, and we can just delete it.
2. Shortening any excessively verbose exception messages.
3. Conditionalizing some of our non-critical logging code in a way that allows the compiler to delete it from release builds.
ProGuard can do the third:
http://proguard.sourceforge.net/manual/examples.html#logging
but note that if any of our logging code has side-effects other than writing a log line, this will break the app. For example:
int i = 4;
Log.d(LOG_TAG, "i is " + i++); // Logs "i is 4"
return i; // Returns 5
isn't safe to prune in this way.
We also rely on our logging in some crash reports, so I would suggest reviewing our log statements to avoid turning off those we might need (hah!), and also making careful use of the early beta flag to maintain full logging for as long as we can.
CCing margaret and snorp to opine, and see if we want to do some little ProGuard tests to see what kind of wins we might see here.
Comment 1•9 years ago
|
||
I think this could be a good meta effort, let's start looking at the log messages and see where we can chip away.
To avoid blocking on fixing the world, developers can file sub-bugs with patches whenever they feel motivated to spend 30 mins looking into this.
Comment 2•4 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: 4 years ago
Resolution: --- → INCOMPLETE
Assignee | ||
Updated•4 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
•