Bug 1036514 - Stumbler logging by setting setprop log.tag.<x> DEBUG. r=nalexander, a=lsblakk
authorGarvan Keeley <gkeeley@mozilla.com>
Fri, 07 Nov 2014 15:18:00 -0500
changeset 233993 70837f682156e343e5111ac6b8f8ae956127c3c8
parent 233992 27edacd145db4c5e0bf9eb664fe1a5e1118766fa
child 233994 e2fb99d8c833bf1d5be92743f7c620802a0bdc90
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander, lsblakk
bugs1036514
milestone35.0a2
Bug 1036514 - Stumbler logging by setting setprop log.tag.<x> DEBUG. r=nalexander, a=lsblakk Setting adb shell setprop log.tag.PassiveStumbler DEBUG will turn on additional debug logging for stumbler. The Log.d messages are wrapped in conditionals for the current log level (which is a cached value).
mobile/android/base/preferences/GeckoPreferences.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/AppGlobals.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/Prefs.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/mainthread/PassiveServiceReceiver.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/Reporter.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/StumblerService.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/blocklist/BSSIDBlockList.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/datahandling/DataStorageManager.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/GPSScanner.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/LocationBlockList.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/ScanManager.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/WifiScanner.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellInfo.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellScanner.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellScannerNoWCDMA.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/uploadthread/AsyncUploader.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/uploadthread/UploadAlarmReceiver.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java
mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/NetworkUtils.java
--- a/mobile/android/base/preferences/GeckoPreferences.java
+++ b/mobile/android/base/preferences/GeckoPreferences.java
@@ -884,19 +884,16 @@ OnSharedPreferenceChangeListener
        Intent intent = new Intent(ACTION_STUMBLER_UPLOAD_PREF)
                 .putExtra("pref", PREFS_GEO_REPORTING)
                 .putExtra("branch", GeckoSharedPrefs.APP_PREFS_NAME)
                 .putExtra("enabled", value)
                 .putExtra("moz_mozilla_api_key", AppConstants.MOZ_STUMBLER_API_KEY);
        if (GeckoAppShell.getGeckoInterface() != null) {
            intent.putExtra("user_agent", GeckoAppShell.getGeckoInterface().getDefaultUAString());
        }
-       if (!AppConstants.MOZILLA_OFFICIAL) {
-           intent.putExtra("is_debug", true);
-       }
        broadcastAction(context, intent);
     }
 
     /**
      * Broadcast the current value of the
      * <code>PREFS_GEO_REPORTING</code> pref.
      */
     public static void broadcastStumblerPref(final Context context) {
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/AppGlobals.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/AppGlobals.java
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.mozstumbler.service;
 
 import java.util.concurrent.ConcurrentLinkedQueue;
 
 public class AppGlobals {
-    public static final String LOG_PREFIX = "Stumbler:";
+    public static final String LOG_PREFIX = "Stumbler_";
 
     /* All intent actions start with this string. Only locally broadcasted. */
     public static final String ACTION_NAMESPACE = "org.mozilla.mozstumbler.intent.action";
 
     /* Handle this for logging reporter info. */
     public static final String ACTION_GUI_LOG_MESSAGE = AppGlobals.ACTION_NAMESPACE + ".LOG_MESSAGE";
     public static final String ACTION_GUI_LOG_MESSAGE_EXTRA = ACTION_GUI_LOG_MESSAGE + ".MESSAGE";
 
@@ -52,12 +52,20 @@ public class AppGlobals {
         if (guiLogMessageBuffer != null) {
             if (isBold) {
                 msg = "<b>" + msg + "</b>";
             }
             guiLogMessageBuffer.add("<font color='" + color +"'>" + msg + "</font>");
         }
     }
 
+    public static String makeLogTag(String name) {
+        final int maxLen = 23 - LOG_PREFIX.length();
+        if (name.length() > maxLen) {
+            name = name.substring(name.length() - maxLen, name.length());
+        }
+        return LOG_PREFIX + name;
+    }
+
     public static final String ACTION_TEST_SETTING_ENABLED = "stumbler-test-setting-enabled";
     public static final String ACTION_TEST_SETTING_DISABLED = "stumbler-test-setting-disabled";
 }
 
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/Prefs.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/Prefs.java
@@ -9,17 +9,17 @@ import android.annotation.TargetApi;
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.location.Location;
 import android.os.Build.VERSION;
 import android.text.TextUtils;
 import android.util.Log;
 
 public  final class Prefs {
-    private static final String LOG_TAG = Prefs.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(Prefs.class.getSimpleName());
     private static final String NICKNAME_PREF = "nickname";
     private static final String USER_AGENT_PREF = "user-agent";
     private static final String VALUES_VERSION_PREF = "values_version";
     private static final String WIFI_ONLY = "wifi_only";
     private static final String LAT_PREF = "lat_pref";
     private static final String LON_PREF = "lon_pref";
     private static final String GEOFENCE_HERE = "geofence_here";
     private static final String GEOFENCE_SWITCH = "geofence_switch";
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/mainthread/PassiveServiceReceiver.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/mainthread/PassiveServiceReceiver.java
@@ -24,37 +24,41 @@ import org.mozilla.mozstumbler.service.s
  *    The StumblerService is where the enabled state is checked, and if not enabled, the
  *    service stops immediately.
  *
  * 3) Upload notification: onReceive intents are used to tell the StumblerService to check for upload.
  *    In the Fennec host app use, startup and pause are used as indicators to the StumblerService that now
  *    is a good time to try upload, as it is likely that the network is in use.
  */
 public class PassiveServiceReceiver extends BroadcastReceiver {
-    static final String LOG_TAG = AppGlobals.LOG_PREFIX + PassiveServiceReceiver.class.getSimpleName();
+    // This allows global debugging logs to be enabled by doing
+    // |adb shell setprop log.tag.PassiveStumbler DEBUG|
+    static final String LOG_TAG = "PassiveStumbler";
 
     @Override
     public void onReceive(Context context, Intent intent) {
         if (intent == null) {
             return;
         }
 
+        // This value is cached, so if |setprop| is performed (as described on the LOG_TAG above),
+        // then the start/stop intent must be resent by toggling the setting or stopping/starting Fennec.
+        // This does not guard against dumping PII (PII in stumbler is location, wifi BSSID, cell tower details).
+        AppGlobals.isDebug = Log.isLoggable(LOG_TAG, Log.DEBUG);
+
         final String action = intent.getAction();
         final boolean isIntentFromHostApp = (action != null) && action.contains(".STUMBLER_PREF");
         if (!isIntentFromHostApp) {
             Log.d(LOG_TAG, "Stumbler: received intent external to host app");
             Intent startServiceIntent = new Intent(context, StumblerService.class);
             startServiceIntent.putExtra(StumblerService.ACTION_NOT_FROM_HOST_APP, true);
             context.startService(startServiceIntent);
             return;
         }
 
-        if (intent.hasExtra("is_debug")) {
-            AppGlobals.isDebug = intent.getBooleanExtra("is_debug", false);
-        }
         StumblerService.sFirefoxStumblingEnabled.set(intent.getBooleanExtra("enabled", false));
 
         if (!StumblerService.sFirefoxStumblingEnabled.get()) {
             // This calls the service's onDestroy(), and the service's onHandleIntent(...) is not called
             context.stopService(new Intent(context, StumblerService.class));
             // For testing service messages were received
             context.sendBroadcast(new Intent(AppGlobals.ACTION_TEST_SETTING_DISABLED));
             return;
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/Reporter.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/Reporter.java
@@ -25,17 +25,17 @@ import org.mozilla.mozstumbler.service.s
 import org.mozilla.mozstumbler.service.stumblerthread.datahandling.DataStorageManager;
 import org.mozilla.mozstumbler.service.stumblerthread.datahandling.StumblerBundle;
 import org.mozilla.mozstumbler.service.stumblerthread.scanners.cellscanner.CellInfo;
 import org.mozilla.mozstumbler.service.stumblerthread.scanners.cellscanner.CellScanner;
 import org.mozilla.mozstumbler.service.stumblerthread.scanners.GPSScanner;
 import org.mozilla.mozstumbler.service.stumblerthread.scanners.WifiScanner;
 
 public final class Reporter extends BroadcastReceiver {
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + Reporter.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(Reporter.class.getSimpleName());
     public static final String ACTION_FLUSH_TO_BUNDLE = AppGlobals.ACTION_NAMESPACE + ".FLUSH";
     private boolean mIsStarted;
 
     /* The maximum number of Wi-Fi access points in a single observation. */
     private static final int MAX_WIFIS_PER_LOCATION = 200;
 
     /* The maximum number of cells in a single observation */
     private static final int MAX_CELLS_PER_LOCATION  = 50;
@@ -190,17 +190,18 @@ public final class Reporter extends Broa
             cellCount = mlsObj.getInt(DataStorageContract.ReportsColumns.CELL_COUNT);
 
         } catch (JSONException e) {
             Log.w(LOG_TAG, "Failed to convert bundle to JSON: " + e);
             return;
         }
 
         if (AppGlobals.isDebug) {
-            Log.d(LOG_TAG, "Received bundle: " + mlsObj.toString());
+            // PII: do not log the bundle without obfuscating it
+            Log.d(LOG_TAG, "Received bundle");
         }
 
         if (wifiCount + cellCount < 1) {
             return;
         }
 
         try {
             DataStorageManager.getInstance().insert(mlsObj.toString(), wifiCount, cellCount);
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/StumblerService.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/StumblerService.java
@@ -22,17 +22,17 @@ import org.mozilla.mozstumbler.service.u
 import org.mozilla.mozstumbler.service.utils.NetworkUtils;
 import org.mozilla.mozstumbler.service.utils.PersistentIntentService;
 
 // In stand-alone service mode (a.k.a passive scanning mode), this is created from PassiveServiceReceiver (by calling startService).
 // The StumblerService is a sticky unbound service in this usage.
 //
 public class StumblerService extends PersistentIntentService
         implements DataStorageManager.StorageIsEmptyTracker {
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + StumblerService.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(StumblerService.class.getSimpleName());
     public static final String ACTION_BASE = AppGlobals.ACTION_NAMESPACE;
     public static final String ACTION_START_PASSIVE = ACTION_BASE + ".START_PASSIVE";
     public static final String ACTION_EXTRA_MOZ_API_KEY = ACTION_BASE + ".MOZKEY";
     public static final String ACTION_EXTRA_USER_AGENT = ACTION_BASE + ".USER_AGENT";
     public static final String ACTION_NOT_FROM_HOST_APP = ACTION_BASE + ".NOT_FROM_HOST";
     public static final AtomicBoolean sFirefoxStumblingEnabled = new AtomicBoolean();
     protected final ScanManager mScanManager = new ScanManager();
     protected final Reporter mReporter = new Reporter();
@@ -139,16 +139,18 @@ public class StumblerService extends Per
         setIntentRedelivery(true);
     }
 
     // Called from the main thread
     @Override
     public void onDestroy() {
         super.onDestroy();
 
+        UploadAlarmReceiver.cancelAlarm(this, !mScanManager.isPassiveMode());
+
         if (!mScanManager.isScanning()) {
             return;
         }
 
         // Used to move these disk I/O ops off the calling thread. The current operations here are synchronized,
         // however instead of creating another thread (if onDestroy grew to have concurrency complications)
         // we could be messaging the stumbler thread to perform a shutdown function.
         new AsyncTask<Void, Void, Void>() {
@@ -193,17 +195,21 @@ public class StumblerService extends Per
 
         final boolean isScanEnabledInPrefs = Prefs.getInstance().getFirefoxScanEnabled();
 
         if (!isScanEnabledInPrefs && intent.getBooleanExtra(ACTION_NOT_FROM_HOST_APP, false)) {
             stopSelf();
             return;
         }
 
-        if (!DataStorageManager.getInstance().isDirEmpty()) {
+        boolean hasFilesWaiting = !DataStorageManager.getInstance().isDirEmpty();
+        if (AppGlobals.isDebug) {
+            Log.d(LOG_TAG, "Files waiting:" + hasFilesWaiting);
+        }
+        if (hasFilesWaiting) {
             // non-empty on startup, schedule an upload
             // This is the only upload trigger in Firefox mode
             // Firefox triggers this ~4 seconds after startup (after Gecko is loaded), add a small delay to avoid
             // clustering with other operations that are triggered at this time.
             final long lastAttemptedTime = Prefs.getInstance().getLastAttemptedUploadTime();
             final long timeNow = System.currentTimeMillis();
 
             if (timeNow - lastAttemptedTime < PASSIVE_UPLOAD_FREQ_GUARD_MSEC) {
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/blocklist/BSSIDBlockList.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/blocklist/BSSIDBlockList.java
@@ -6,17 +6,17 @@ package org.mozilla.mozstumbler.service.
 
 import android.net.wifi.ScanResult;
 import android.util.Log;
 import org.mozilla.mozstumbler.service.AppGlobals;
 import java.util.Locale;
 import java.util.regex.Pattern;
 
 public final class BSSIDBlockList {
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + BSSIDBlockList.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(BSSIDBlockList.class.getSimpleName());
     private static final String NULL_BSSID = "000000000000";
     private static final String WILDCARD_BSSID = "ffffffffffff";
     private static final Pattern BSSID_PATTERN = Pattern.compile("([0-9a-f]{12})");
     private static String[] sOuiList = new String[]{};
 
     private BSSIDBlockList() {
     }
 
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/datahandling/DataStorageManager.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/datahandling/DataStorageManager.java
@@ -33,17 +33,17 @@ import java.util.TimerTask;
  *
  * If the network is reasonably active, and reporting is slow enough, there is no disk I/O, it all happens
  * in-memory.
  *
  * Also of note: the in-memory buffers (both mCurrentReports and mCurrentReportsSendBuffer) are saved
  * when the service is destroyed.
  */
 public class DataStorageManager {
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + DataStorageManager.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(DataStorageManager.class.getSimpleName());
 
     // The max number of reports stored in the mCurrentReports. Each report is a GPS location plus wifi and cell scan.
     // After this size is reached, data is persisted to disk, mCurrentReports is cleared.
     private static final int MAX_REPORTS_IN_MEMORY = 50;
 
     // Used to cap the amount of data stored. When this limit is hit, no more data is saved to disk
     // until the data is uploaded, or and data exceeds DEFAULT_MAX_WEEKS_DATA_ON_DISK.
     private static final long DEFAULT_MAX_BYTES_STORED_ON_DISK = 1024 * 250; // 250 KiB max by default
@@ -196,29 +196,17 @@ public class DataStorageManager {
         public final ReportFileList fileList;
     }
 
     public interface StorageIsEmptyTracker {
         public void notifyStorageStateEmpty(boolean isEmpty);
     }
 
     private String getStorageDir(Context c) {
-        File dir = null;
-        if (AppGlobals.isDebug) {
-            // in debug, put files in public location
-            dir = c.getExternalFilesDir(null);
-            if (dir != null) {
-                dir = new File(dir.getAbsolutePath() + "/mozstumbler");
-            }
-        }
-
-        if (dir == null) {
-            dir = c.getFilesDir();
-        }
-
+        File dir = c.getFilesDir();
         if (!dir.exists()) {
             boolean ok = dir.mkdirs();
             if (!ok) {
                 Log.d(LOG_TAG, "getStorageDir: error in mkdirs()");
             }
         }
 
         return dir.getPath();
@@ -409,19 +397,16 @@ public class DataStorageManager {
         if (reports != null) {
             for(String s: reports) {
                 sb.append(sep).append(s);
                 sep = separator;
             }
         }
 
         final String result = sb.append(kSuffix).toString();
-        if (AppGlobals.isDebug) {
-            Log.d(LOG_TAG, result);
-        }
         return result;
     }
 
     public synchronized void saveCurrentReportsToDisk() throws IOException {
         saveCurrentReportsSendBufferToDisk();
         if (mCurrentReports.reports.size() < 1) {
             return;
         }
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/GPSScanner.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/GPSScanner.java
@@ -29,17 +29,17 @@ public class GPSScanner implements Locat
     public static final String ACTION_ARG_TIME = AppGlobals.ACTION_ARG_TIME;
     public static final String SUBJECT_NEW_STATUS = "new_status";
     public static final String SUBJECT_LOCATION_LOST = "location_lost";
     public static final String SUBJECT_NEW_LOCATION = "new_location";
     public static final String NEW_STATUS_ARG_FIXES = "fixes";
     public static final String NEW_STATUS_ARG_SATS = "sats";
     public static final String NEW_LOCATION_ARG_LOCATION = "location";
 
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + GPSScanner.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(GPSScanner.class.getSimpleName());
     private static final int MIN_SAT_USED_IN_FIX = 3;
     private static final long ACTIVE_MODE_GPS_MIN_UPDATE_TIME_MS = 1000;
     private static final float ACTIVE_MODE_GPS_MIN_UPDATE_DISTANCE_M = 10;
     private static final long PASSIVE_GPS_MIN_UPDATE_FREQ_MS = 3000;
     private static final float PASSIVE_GPS_MOVEMENT_MIN_DELTA_M = 30;
 
     private final LocationBlockList mBlockList = new LocationBlockList();
     private final Context mContext;
@@ -186,25 +186,20 @@ public class GPSScanner implements Locat
         Date date = new Date(location.getTime());
         SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
         String time = formatter.format(date);
         logMsg += String.format("%s Coord: %.4f,%.4f, Acc: %.0f, Speed: %.0f, Alt: %.0f, Bearing: %.1f", time, location.getLatitude(),
                 location.getLongitude(), location.getAccuracy(), location.getSpeed(), location.getAltitude(), location.getBearing());
         sendToLogActivity(logMsg);
 
         if (mBlockList.contains(location)) {
-            Log.w(LOG_TAG, "Blocked location: " + location);
             reportLocationLost();
             return;
         }
 
-        if (AppGlobals.isDebug) {
-            Log.d(LOG_TAG, "New location: " + location);
-        }
-
         mLocation = location;
 
         if (!mAutoGeofencing) {
             reportNewLocationReceived(location);
         }
         mLocationCount++;
 
         if (mIsPassiveMode) {
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/LocationBlockList.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/LocationBlockList.java
@@ -5,17 +5,17 @@
 package org.mozilla.mozstumbler.service.stumblerthread.scanners;
 
 import android.location.Location;
 import android.util.Log;
 import org.mozilla.mozstumbler.service.AppGlobals;
 import org.mozilla.mozstumbler.service.Prefs;
 
 public final class LocationBlockList {
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + LocationBlockList.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(LocationBlockList.class.getSimpleName());
     private static final double MAX_ALTITUDE = 8848;      // Mount Everest's altitude in meters
     private static final double MIN_ALTITUDE = -418;      // Dead Sea's altitude in meters
     private static final float MAX_SPEED = 340.29f;   // Mach 1 in meters/second
     private static final float MIN_ACCURACY = 500;       // meter radius
     private static final long MIN_TIMESTAMP = 946684801; // 2000-01-01 00:00:01
     private static final double GEOFENCE_RADIUS = 0.01;      // .01 degrees is approximately 1km
     private static final long MILLISECONDS_PER_DAY = 86400000;
 
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/ScanManager.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/ScanManager.java
@@ -18,17 +18,17 @@ import org.mozilla.mozstumbler.service.s
 import org.mozilla.mozstumbler.service.stumblerthread.scanners.cellscanner.CellScanner;
 import org.mozilla.mozstumbler.service.AppGlobals.ActiveOrPassiveStumbling;
 
 import java.util.Date;
 import java.util.Timer;
 import java.util.TimerTask;
 
 public class ScanManager {
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + ScanManager.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(ScanManager.class.getSimpleName());
     private Timer mPassiveModeFlushTimer;
     private Context mContext;
     private boolean mIsScanning;
     private GPSScanner mGPSScanner;
     private WifiScanner mWifiScanner;
     private CellScanner mCellScanner;
     private ActiveOrPassiveStumbling mStumblingMode = ActiveOrPassiveStumbling.ACTIVE_STUMBLING;
 
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/WifiScanner.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/WifiScanner.java
@@ -35,17 +35,17 @@ public class WifiScanner extends Broadca
     public static final String ACTION_WIFIS_SCANNED = ACTION_BASE + "WIFIS_SCANNED";
     public static final String ACTION_WIFIS_SCANNED_ARG_RESULTS = "scan_results";
     public static final String ACTION_WIFIS_SCANNED_ARG_TIME = AppGlobals.ACTION_ARG_TIME;
 
     public static final int STATUS_IDLE = 0;
     public static final int STATUS_ACTIVE = 1;
     public static final int STATUS_WIFI_DISABLED = -1;
 
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + WifiScanner.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(WifiScanner.class.getSimpleName());
     private static final long WIFI_MIN_UPDATE_TIME = 5000; // milliseconds
 
     private boolean mStarted;
     private final Context mContext;
     private WifiLock mWifiLock;
     private Timer mWifiScanTimer;
     private final Set<String> mAPs = Collections.synchronizedSet(new HashSet<String>());
     private final AtomicInteger mVisibleAPs = new AtomicInteger();
@@ -189,21 +189,19 @@ public class WifiScanner extends Broadca
         mWifiScanTimer.cancel();
         mWifiScanTimer = null;
 
         mVisibleAPs.set(0);
     }
 
     public static boolean shouldLog(ScanResult scanResult) {
         if (BSSIDBlockList.contains(scanResult)) {
-            Log.w(LOG_TAG, "Blocked BSSID: " + scanResult);
             return false;
         }
         if (SSIDBlockList.contains(scanResult)) {
-            Log.w(LOG_TAG, "Blocked SSID: " + scanResult);
             return false;
         }
         return true;
     }
 
     private WifiManager getWifiManager() {
         return (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
     }
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellInfo.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellInfo.java
@@ -14,17 +14,17 @@ import android.telephony.cdma.CdmaCellLo
 import android.telephony.gsm.GsmCellLocation;
 import android.util.Log;
 
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.mozilla.mozstumbler.service.AppGlobals;
 
 public class CellInfo implements Parcelable {
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + CellInfo.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(CellInfo.class.getSimpleName());
 
     public static final String RADIO_GSM = "gsm";
     public static final String RADIO_CDMA = "cdma";
     public static final String RADIO_WCDMA = "wcdma";
 
     public static final String CELL_RADIO_GSM = "gsm";
     public static final String CELL_RADIO_UMTS = "umts";
     public static final String CELL_RADIO_CDMA = "cdma";
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellScanner.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellScanner.java
@@ -21,17 +21,17 @@ import org.mozilla.mozstumbler.service.A
 
 
 public class CellScanner {
     public static final String ACTION_BASE = AppGlobals.ACTION_NAMESPACE + ".CellScanner.";
     public static final String ACTION_CELLS_SCANNED = ACTION_BASE + "CELLS_SCANNED";
     public static final String ACTION_CELLS_SCANNED_ARG_CELLS = "cells";
     public static final String ACTION_CELLS_SCANNED_ARG_TIME = AppGlobals.ACTION_ARG_TIME;
 
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + CellScanner.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(CellScanner.class.getSimpleName());
     private static final long CELL_MIN_UPDATE_TIME = 1000; // milliseconds
 
     private final Context mContext;
     private static CellScannerImpl sImpl;
     private Timer mCellScanTimer;
     private final Set<String> mCells = new HashSet<String>();
     private int mCurrentCellInfoCount;
 
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellScannerNoWCDMA.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/stumblerthread/scanners/cellscanner/CellScannerNoWCDMA.java
@@ -26,17 +26,17 @@ import org.mozilla.mozstumbler.service.A
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
 /* Fennec does not yet support the api level for WCDMA import */
 public class CellScannerNoWCDMA implements CellScanner.CellScannerImpl {
 
-    protected static String LOG_TAG = AppGlobals.LOG_PREFIX + CellScannerNoWCDMA.class.getSimpleName();
+    protected static String LOG_TAG = AppGlobals.makeLogTag(CellScannerNoWCDMA.class.getSimpleName());
     protected GetAllCellInfoScannerImpl mGetAllInfoCellScanner;
     protected TelephonyManager mTelephonyManager;
     protected boolean mIsStarted;
     protected int mPhoneType;
     protected final Context mContext;
     protected volatile int mSignalStrength;
     protected volatile int mCdmaDbm;
 
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/uploadthread/AsyncUploader.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/uploadthread/AsyncUploader.java
@@ -19,17 +19,17 @@ import org.mozilla.mozstumbler.service.u
 /* Only one at a time may be uploading. If executed while another upload is in progress
 * it will return immediately, and SyncResult is null.
 *
 * Threading:
 * Uploads on a separate thread. ONLY DataStorageManager is thread-safe, do not call
 * preferences, do not call any code that isn't thread-safe. You will cause suffering.
 * An exception is made for AppGlobals.isDebug, a false reading is of no consequence. */
 public class AsyncUploader extends AsyncTask<Void, Void, SyncSummary> {
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + AsyncUploader.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(AsyncUploader.class.getSimpleName());
     private final UploadSettings mSettings;
     private final Object mListenerLock = new Object();
     private AsyncUploaderListener mListener;
     private static final AtomicBoolean sIsUploading = new AtomicBoolean();
     private String mNickname;
 
     public interface AsyncUploaderListener {
         public void onUploadComplete(SyncSummary result);
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/uploadthread/UploadAlarmReceiver.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/uploadthread/UploadAlarmReceiver.java
@@ -25,17 +25,17 @@ import org.mozilla.mozstumbler.service.u
 // 2) Changing the pref in Fennec to stumble or not.
 // 3) Boot intent (and SD card app available intent).
 //
 // Threading:
 // - scheduled from the stumbler thread
 // - triggered from the main thread
 // - actual work is done the upload thread (AsyncUploader)
 public class UploadAlarmReceiver extends BroadcastReceiver {
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + UploadAlarmReceiver.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(UploadAlarmReceiver.class.getSimpleName());
     private static final String EXTRA_IS_REPEATING = "is_repeating";
     private static boolean sIsAlreadyScheduled;
 
     public UploadAlarmReceiver() {}
 
     public static class UploadAlarmService extends IntentService {
 
         public UploadAlarmService(String name) {
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java
@@ -15,17 +15,17 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
 
 public abstract class AbstractCommunicator {
 
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + AbstractCommunicator.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(AbstractCommunicator.class.getSimpleName());
     private static final String NICKNAME_HEADER = "X-Nickname";
     private static final String USER_AGENT_HEADER = "User-Agent";
     private HttpURLConnection mHttpURLConnection;
     private final String mUserAgent;
     private static int sBytesSentTotal = 0;
     private static String sMozApiKey;
 
     public abstract String getUrlString();
--- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/NetworkUtils.java
+++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/NetworkUtils.java
@@ -6,17 +6,17 @@ package org.mozilla.mozstumbler.service.
 
 import android.content.Context;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 import android.util.Log;
 import org.mozilla.mozstumbler.service.AppGlobals;
 
 public final class NetworkUtils {
-    private static final String LOG_TAG = AppGlobals.LOG_PREFIX + NetworkUtils.class.getSimpleName();
+    private static final String LOG_TAG = AppGlobals.makeLogTag(NetworkUtils.class.getSimpleName());
 
     ConnectivityManager mConnectivityManager;
     static NetworkUtils sInstance;
 
     /* Created at startup by app, or service, using a context. */
     static public void createGlobalInstance(Context context) {
         sInstance = new NetworkUtils();
         sInstance.mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);