Bug 1275439 - Switch debugging to MOZ_LOG. r=erahm
authorRalph Giles <giles@mozilla.com>
Mon, 16 May 2016 15:49:20 -0700
changeset 299059 35574c1aa9697cb60f05ba4c9d7175d1ffc59efc
parent 299058 da921523812f62a85d6d7963703af963f99ad9ed
child 299060 6f4868096fd610dc4a205632e170f6332479ac22
push id30288
push userryanvm@gmail.com
push dateThu, 26 May 2016 15:04:54 +0000
treeherdermozilla-central@56e5195bef5b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1275439
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1275439 - Switch debugging to MOZ_LOG. r=erahm This is shorter than MOZ_LOG_MODULES and equally clear. Add a deprecation warning to encourge folks to migrate, and update references in the test runner. MozReview-Commit-ID: HYY3Q9tSu13
testing/mochitest/runtests.py
xpcom/base/Logging.cpp
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -78,21 +78,23 @@ except ImportError:
 
 here = os.path.abspath(os.path.dirname(__file__))
 
 
 ########################################
 # Option for MOZ (former NSPR) logging #
 ########################################
 
-# Set the desired log modules you want a log be produced by a try run for, or leave blank to disable the feature.
-# This will be passed to MOZ_LOG_MODULES environment variable. Try run will then put a download link for all log files
+# Set the desired log modules you want a log be produced
+# by a try run for, or leave blank to disable the feature.
+# This will be passed to MOZ_LOG environment variable.
+# Try run will then put a download link for all log files
 # on tbpl.mozilla.org.
 
-MOZ_LOG_MODULES = ""
+MOZ_LOG = ""
 
 #####################
 # Test log handling #
 #####################
 
 # output processing
 
 
@@ -1229,21 +1231,21 @@ toolbar#nav-bar {
                 browserEnv["MOZ_GMP_PATH"] = gmp_path
         except EnvironmentError:
             self.log.error('Could not find path to gmp-fake plugin!')
             return None
 
         if options.fatalAssertions:
             browserEnv["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
 
-        # Produce a mozlog, if setup (see MOZ_LOG_MODULES global at the top of
+        # Produce a mozlog, if setup (see MOZ_LOG global at the top of
         # this script).
-        self.mozLogs = MOZ_LOG_MODULES and "MOZ_UPLOAD_DIR" in os.environ
+        self.mozLogs = MOZ_LOG and "MOZ_UPLOAD_DIR" in os.environ
         if self.mozLogs:
-            browserEnv["MOZ_LOG_MODULES"] = MOZ_LOG_MODULES
+            browserEnv["MOZ_LOG"] = MOZ_LOG
 
         if debugger and not options.slowscript:
             browserEnv["JS_DISABLE_SLOW_SCRIPT_SIGNALS"] = "1"
 
         # For e10s, our tests default to suppressing the "unsafe CPOW usage"
         # warnings that can plague test logs.
         if not options.enableCPOWWarnings:
             browserEnv["DISABLE_UNSAFE_CPOW_WARNINGS"] = "1"
--- a/xpcom/base/Logging.cpp
+++ b/xpcom/base/Logging.cpp
@@ -117,19 +117,30 @@ public:
   /**
    * Loads config from env vars if present.
    */
   void Init()
   {
     bool shouldAppend = false;
     bool addTimestamp = false;
     bool isSync = false;
-    const char* modules = PR_GetEnv("MOZ_LOG_MODULES");
+    const char* modules = PR_GetEnv("MOZ_LOG");
+    if (!modules || !modules[0]) {
+      modules = PR_GetEnv("MOZ_LOG_MODULES");
+      if (modules) {
+        NS_WARNING("MOZ_LOG_MODULES is deprecated."
+            "\nPlease use MOZ_LOG instead.");
+      }
+    }
     if (!modules || !modules[0]) {
       modules = PR_GetEnv("NSPR_LOG_MODULES");
+      if (modules) {
+        NS_WARNING("NSPR_LOG_MODULES is deprecated."
+            "\nPlease use MOZ_LOG instead.");
+      }
     }
 
     NSPRLogModulesParser(modules,
         [&shouldAppend, &addTimestamp, &isSync]
             (const char* aName, LogLevel aLevel) mutable {
           if (strcmp(aName, "append") == 0) {
             shouldAppend = true;
           } else if (strcmp(aName, "timestamp") == 0) {