Bug 1248565 - Introduce MOZ_LOG_* variables for mozilla logging. r=erahm
authorHonza Bambas <honzab.moz@firemni.cz>
Thu, 10 Mar 2016 08:22:00 -0500
changeset 289420 b01c58d030d091b70a3891a118037cffa7e9e139
parent 289419 e41e3bc842dfda1b70080688f93de86ebe651790
child 289421 fc3daa3b3aefa9436f7672a8d6ae9c4f9f0cd855
push id30102
push userryanvm@gmail.com
push dateSat, 19 Mar 2016 15:23:17 +0000
treeherdermozilla-central@720fb3d55e28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1248565
milestone48.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 1248565 - Introduce MOZ_LOG_* variables for mozilla logging. r=erahm
xpcom/base/Logging.cpp
--- a/xpcom/base/Logging.cpp
+++ b/xpcom/base/Logging.cpp
@@ -117,17 +117,21 @@ public:
   /**
    * Loads config from env vars if present.
    */
   void Init()
   {
     bool shouldAppend = false;
     bool addTimestamp = false;
     bool isSync = false;
-    const char* modules = PR_GetEnv("NSPR_LOG_MODULES");
+    const char* modules = PR_GetEnv("MOZ_LOG_MODULES");
+    if (!modules || !modules[0]) {
+      modules = PR_GetEnv("NSPR_LOG_MODULES");
+    }
+
     NSPRLogModulesParser(modules,
         [&shouldAppend, &addTimestamp, &isSync]
             (const char* aName, LogLevel aLevel) mutable {
           if (strcmp(aName, "append") == 0) {
             shouldAppend = true;
           } else if (strcmp(aName, "timestamp") == 0) {
             addTimestamp = true;
           } else if (strcmp(aName, "sync") == 0) {
@@ -135,17 +139,21 @@ public:
           } else {
             LogModule::Get(aName)->SetLevel(aLevel);
           }
     });
 
     mAddTimestamp = addTimestamp;
     mIsSync = isSync;
 
-    const char* logFile = PR_GetEnv("NSPR_LOG_FILE");
+    const char* logFile = PR_GetEnv("MOZ_LOG_FILE");
+    if (!logFile || !logFile[0]) {
+      logFile = PR_GetEnv("NSPR_LOG_FILE");
+    }
+
     if (logFile && logFile[0]) {
       static const char kPIDToken[] = "%PID";
       const char* pidTokenPtr = strstr(logFile, kPIDToken);
       char buf[2048];
       if (pidTokenPtr &&
           snprintf_literal(buf, "%.*s%d%s",
             static_cast<int>(pidTokenPtr - logFile), logFile,
             detail::log_pid(),