Bug 790496 - Make maintenance service errors stand out more. r=ehsan
authorBrian R. Bondy <netzen@gmail.com>
Thu, 25 Oct 2012 22:34:03 -0400
changeset 111480 612a40a222d7cd9cca0d50b80da075fac00b5c41
parent 111479 3a68d4377cd815efd7973ca515e8dbd3ce45a602
child 111481 56ea8204864df62e250ebc18ab44d8b3c82f077a
push id23748
push userryanvm@gmail.com
push dateFri, 26 Oct 2012 11:29:12 +0000
treeherdermozilla-central@8586bd350875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs790496
milestone19.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 790496 - Make maintenance service errors stand out more. r=ehsan
toolkit/components/maintenanceservice/certificatecheck.cpp
toolkit/components/maintenanceservice/maintenanceservice.cpp
toolkit/components/maintenanceservice/registrycertificates.cpp
toolkit/components/maintenanceservice/serviceinstall.cpp
toolkit/components/maintenanceservice/workmonitor.cpp
toolkit/mozapps/update/common/uachelper.cpp
toolkit/mozapps/update/common/updatelogging.cpp
toolkit/mozapps/update/common/updatelogging.h
toolkit/mozapps/update/updater/updater.cpp
--- a/toolkit/components/maintenanceservice/certificatecheck.cpp
+++ b/toolkit/components/maintenanceservice/certificatecheck.cpp
@@ -39,64 +39,64 @@ CheckCertificateForPEFile(LPCWSTR filePa
   BOOL result = CryptQueryObject(CERT_QUERY_OBJECT_FILE,
                                   filePath, 
                                   CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED,
                                   CERT_QUERY_CONTENT_FLAG_ALL, 
                                   0, &encoding, &contentType,
                                   &formatType, &certStore, &cryptMsg, NULL);
   if (!result) {
     lastError = GetLastError();
-    LOG(("CryptQueryObject failed with %d\n", lastError));
+    LOG_WARN(("CryptQueryObject failed.  (%d)", lastError));
     goto cleanup;
   }
 
   // Pass in NULL to get the needed signer information size.
   DWORD signerInfoSize;
   result = CryptMsgGetParam(cryptMsg, CMSG_SIGNER_INFO_PARAM, 0, 
                             NULL, &signerInfoSize);
   if (!result) {
     lastError = GetLastError();
-    LOG(("CryptMsgGetParam failed with %d\n", lastError));
+    LOG_WARN(("CryptMsgGetParam failed.  (%d)", lastError));
     goto cleanup;
   }
 
   // Allocate the needed size for the signer information.
   signerInfo = (PCMSG_SIGNER_INFO)LocalAlloc(LPTR, signerInfoSize);
   if (!signerInfo) {
     lastError = GetLastError();
-    LOG(("Unable to allocate memory for Signer Info.\n"));
+    LOG_WARN(("Unable to allocate memory for Signer Info.  (%d)", lastError));
     goto cleanup;
   }
 
   // Get the signer information (PCMSG_SIGNER_INFO).
   // In particular we want the issuer and serial number.
   result = CryptMsgGetParam(cryptMsg, CMSG_SIGNER_INFO_PARAM, 0, 
                             (PVOID)signerInfo, &signerInfoSize);
   if (!result) {
     lastError = GetLastError();
-    LOG(("CryptMsgGetParam failed with %d\n", lastError));
+    LOG_WARN(("CryptMsgGetParam failed.  (%d)", lastError));
     goto cleanup;
   }
 
   // Search for the signer certificate in the certificate store.
   CERT_INFO certInfo;     
   certInfo.Issuer = signerInfo->Issuer;
   certInfo.SerialNumber = signerInfo->SerialNumber;
   certContext = CertFindCertificateInStore(certStore, ENCODING, 0, 
                                            CERT_FIND_SUBJECT_CERT,
                                            (PVOID)&certInfo, NULL);
   if (!certContext) {
     lastError = GetLastError();
-    LOG(("CertFindCertificateInStore failed with %d\n", lastError));
+    LOG_WARN(("CertFindCertificateInStore failed.  (%d)", lastError));
     goto cleanup;
   }
 
   if (!DoCertificateAttributesMatch(certContext, infoToMatch)) {
     lastError = ERROR_NOT_FOUND;
-    LOG(("Certificate did not match issuer or name\n"));
+    LOG_WARN(("Certificate did not match issuer or name.  (%d)", lastError));
     goto cleanup;
   }
 
 cleanup:
   if (signerInfo) {
     LocalFree(signerInfo);
   }
   if (certContext) {
@@ -128,31 +128,32 @@ DoCertificateAttributesMatch(PCCERT_CONT
   if (infoToMatch.issuer) {
     // Pass in NULL to get the needed size of the issuer buffer.
     dwData = CertGetNameString(certContext, 
                                CERT_NAME_SIMPLE_DISPLAY_TYPE,
                                CERT_NAME_ISSUER_FLAG, NULL,
                                NULL, 0);
 
     if (!dwData) {
-      LOG(("CertGetNameString failed.\n"));
+      LOG_WARN(("CertGetNameString failed.  (%d)", GetLastError()));
       return FALSE;
     }
 
     // Allocate memory for Issuer name buffer.
     LPTSTR szName = (LPTSTR)LocalAlloc(LPTR, dwData * sizeof(WCHAR));
     if (!szName) {
-      LOG(("Unable to allocate memory for issuer name.\n"));
+      LOG_WARN(("Unable to allocate memory for issuer name.  (%d)",
+                GetLastError()));
       return FALSE;
     }
 
     // Get Issuer name.
     if (!CertGetNameString(certContext, CERT_NAME_SIMPLE_DISPLAY_TYPE,
                            CERT_NAME_ISSUER_FLAG, NULL, szName, dwData)) {
-      LOG(("CertGetNameString failed.\n"));
+      LOG_WARN(("CertGetNameString failed.  (%d)", GetLastError()));
       LocalFree(szName);
       return FALSE;
     }
 
     // If the issuer does not match, return a failure.
     if (!infoToMatch.issuer ||
         wcscmp(szName, infoToMatch.issuer)) {
       LocalFree(szName);
@@ -163,31 +164,32 @@ DoCertificateAttributesMatch(PCCERT_CONT
     szName = NULL;
   }
 
   if (infoToMatch.name) {
     // Pass in NULL to get the needed size of the name buffer.
     dwData = CertGetNameString(certContext, CERT_NAME_SIMPLE_DISPLAY_TYPE,
                                0, NULL, NULL, 0);
     if (!dwData) {
-      LOG(("CertGetNameString failed.\n"));
+      LOG_WARN(("CertGetNameString failed.  (%d)", GetLastError()));
       return FALSE;
     }
 
     // Allocate memory for the name buffer.
     szName = (LPTSTR)LocalAlloc(LPTR, dwData * sizeof(WCHAR));
     if (!szName) {
-      LOG(("Unable to allocate memory for subject name.\n"));
+      LOG_WARN(("Unable to allocate memory for subject name.  (%d)",
+                GetLastError()));
       return FALSE;
     }
 
     // Obtain the name.
     if (!(CertGetNameString(certContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0,
                             NULL, szName, dwData))) {
-      LOG(("CertGetNameString failed.\n"));
+      LOG_WARN(("CertGetNameString failed.  (%d)", GetLastError()));
       LocalFree(szName);
       return FALSE;
     }
 
     // If the issuer does not match, return a failure.
     if (!infoToMatch.name || 
         wcscmp(szName, infoToMatch.name)) {
       LocalFree(szName);
@@ -251,18 +253,18 @@ VerifyCertificateTrustForFile(LPCWSTR fi
   trustData.pFile = &fileToCheck;
 
   GUID policyGUID = WINTRUST_ACTION_GENERIC_VERIFY_V2;
   // Check if the file is signed by something that is trusted.
   LONG ret = WinVerifyTrust(NULL, &policyGUID, &trustData);
   if (ERROR_SUCCESS == ret) {
     // The hash that represents the subject is trusted and there were no
     // verification errors.  No publisher nor time stamp chain errors.
-    LOG(("The file \"%ls\" is signed and the signature was verified.\n",
-        filePath));
+    LOG(("The file \"%ls\" is signed and the signature was verified.",
+         filePath));
       return ERROR_SUCCESS;
   }
 
   DWORD lastError = GetLastError();
-  LOG(("There was an error validating trust of the certificate for file"
-       " \"%ls\". Returned: %d, Last error: %d\n", filePath, ret, lastError));
+  LOG_WARN(("There was an error validating trust of the certificate for file"
+            " \"%ls\". Returned: %d.  (%d)", filePath, ret, lastError));
   return ret;
 }
--- a/toolkit/components/maintenanceservice/maintenanceservice.cpp
+++ b/toolkit/components/maintenanceservice/maintenanceservice.cpp
@@ -39,80 +39,79 @@ wmain(int argc, WCHAR **argv)
   // Otherwise, the service is probably being started by the SCM.
   bool forceInstall = !lstrcmpi(argv[1], L"forceinstall");
   if (!lstrcmpi(argv[1], L"install") || forceInstall) {
     WCHAR updatePath[MAX_PATH + 1];
     if (GetLogDirectoryPath(updatePath)) {
       LogInit(updatePath, L"maintenanceservice-install.log");
     }
 
-    LOG(("Installing service"));
     SvcInstallAction action = InstallSvc;
     if (forceInstall) {
       action = ForceInstallSvc;
-      LOG((" with force specified"));
+      LOG(("Installing service with force specified..."));
+    } else {
+      LOG(("Installing service..."));
     }
-    LOG(("...\n"));
 
     bool ret = SvcInstall(action);
     if (!ret) {
-      LOG(("Could not install service (%d)\n", GetLastError()));
+      LOG_WARN(("Could not install service.  (%d)", GetLastError()));
       LogFinish();
       return 1;
     }
 
-    LOG(("The service was installed successfully\n"));
+    LOG(("The service was installed successfully"));
     LogFinish();
     return 0;
   } 
 
   if (!lstrcmpi(argv[1], L"upgrade")) {
     WCHAR updatePath[MAX_PATH + 1];
     if (GetLogDirectoryPath(updatePath)) {
       LogInit(updatePath, L"maintenanceservice-install.log");
     }
-    LOG(("Upgrading service if installed...\n"));
 
-    
+    LOG(("Upgrading service if installed..."));
     if (!SvcInstall(UpgradeSvc)) {
-      LOG(("Could not upgrade service (%d)\n", GetLastError()));
+      LOG_WARN(("Could not upgrade service.  (%d)", GetLastError()));
       LogFinish();
       return 1;
     }
 
-    LOG(("The service was upgraded successfully\n"));
+    LOG(("The service was upgraded successfully"));
     LogFinish();
     return 0;
   }
 
   if (!lstrcmpi(argv[1], L"uninstall")) {
     WCHAR updatePath[MAX_PATH + 1];
     if (GetLogDirectoryPath(updatePath)) {
       LogInit(updatePath, L"maintenanceservice-uninstall.log");
     }
-    LOG(("Uninstalling service...\n"));
+    LOG(("Uninstalling service..."));
     if (!SvcUninstall()) {
-      LOG(("Could not uninstall service (%d)\n", GetLastError()));
+      LOG_WARN(("Could not uninstall service.  (%d)", GetLastError()));
       LogFinish();
       return 1;
     }
-    LOG(("The service was uninstalled successfully\n"));
+    LOG(("The service was uninstalled successfully"));
     LogFinish();
     return 0;
   }
 
   SERVICE_TABLE_ENTRYW DispatchTable[] = { 
     { SVC_NAME, (LPSERVICE_MAIN_FUNCTIONW) SvcMain }, 
     { NULL, NULL } 
   }; 
 
   // This call returns when the service has stopped. 
   // The process should simply terminate when the call returns.
   if (!StartServiceCtrlDispatcherW(DispatchTable)) {
-    LOG(("StartServiceCtrlDispatcher failed (%d)\n", GetLastError()));
+    LOG_WARN(("StartServiceCtrlDispatcher failed.  (%d)", GetLastError()));
   }
 
   return 0;
 }
 
 /**
  * Obtains the base path where logs should be stored
  *
@@ -245,17 +244,17 @@ SvcMain(DWORD argc, LPWSTR *argv)
 
   // Disable every privilege we don't need. Processes started using
   // CreateProcess will use the same token as this process.
   UACHelper::DisablePrivileges(NULL);
 
   // Register the handler function for the service
   gSvcStatusHandle = RegisterServiceCtrlHandlerW(SVC_NAME, SvcCtrlHandler);
   if (!gSvcStatusHandle) {
-    LOG(("RegisterServiceCtrlHandler failed (%d)\n", GetLastError()));
+    LOG_WARN(("RegisterServiceCtrlHandler failed.  (%d)", GetLastError()));
     ExecuteServiceCommand(argc, argv);  
     LogFinish();
     exit(1);
   } 
 
   // These values will be re-used later in calls involving gSvcStatus
   gSvcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
   gSvcStatus.dwServiceSpecificExitCode = 0;
--- a/toolkit/components/maintenanceservice/registrycertificates.cpp
+++ b/toolkit/components/maintenanceservice/registrycertificates.cpp
@@ -34,100 +34,100 @@ DoesBinaryMatchAllowedCertificates(LPCWS
   // to put those certificate attributes in and hence why we always
   // force the non redirected registry under Wow6432Node.
   // This flag is ignored on 32bit systems.
   HKEY baseKeyRaw;
   LONG retCode = RegOpenKeyExW(HKEY_LOCAL_MACHINE, 
                                maintenanceServiceKey, 0, 
                                KEY_READ | KEY_WOW64_64KEY, &baseKeyRaw);
   if (retCode != ERROR_SUCCESS) {
-    LOG(("Could not open key. (%d)\n", retCode));
+    LOG_WARN(("Could not open key.  (%d)", retCode));
     // Our tests run with a different apply directory for each test.
     // We use this registry key on our test slaves to store the 
     // allowed name/issuers.
     retCode = RegOpenKeyExW(HKEY_LOCAL_MACHINE, 
                             TEST_ONLY_FALLBACK_KEY_PATH, 0,
                             KEY_READ | KEY_WOW64_64KEY, &baseKeyRaw);
     if (retCode != ERROR_SUCCESS) {
-      LOG(("Could not open fallback key. (%d)\n", retCode));
+      LOG_WARN(("Could not open fallback key.  (%d)", retCode));
       return FALSE;
     }
   }
   nsAutoRegKey baseKey(baseKeyRaw);
 
   // Get the number of subkeys.
   DWORD subkeyCount = 0;
   retCode = RegQueryInfoKeyW(baseKey, NULL, NULL, NULL, &subkeyCount, NULL,
                              NULL, NULL, NULL, NULL, NULL, NULL);
   if (retCode != ERROR_SUCCESS) {
-    LOG(("Could not query info key: %d\n", retCode));
+    LOG_WARN(("Could not query info key.  (%d)", retCode));
     return FALSE;
   }
 
   // Enumerate the subkeys, each subkey represents an allowed certificate.
   for (DWORD i = 0; i < subkeyCount; i++) { 
     WCHAR subkeyBuffer[MAX_KEY_LENGTH];
     DWORD subkeyBufferCount = MAX_KEY_LENGTH;  
     retCode = RegEnumKeyExW(baseKey, i, subkeyBuffer, 
                             &subkeyBufferCount, NULL, 
                             NULL, NULL, NULL); 
     if (retCode != ERROR_SUCCESS) {
-      LOG(("Could not enum Certs: %d\n", retCode));
+      LOG_WARN(("Could not enum certs.  (%d)", retCode));
       return FALSE;
     }
 
     // Open the subkey for the current certificate
     HKEY subKeyRaw;
     retCode = RegOpenKeyExW(baseKey, 
                             subkeyBuffer, 
                             0, 
                             KEY_READ | KEY_WOW64_64KEY, 
                             &subKeyRaw);
     nsAutoRegKey subKey(subKeyRaw);
     if (retCode != ERROR_SUCCESS) {
-      LOG(("Could not open subkey: %d\n", retCode));
+      LOG_WARN(("Could not open subkey.  (%d)", retCode));
       continue; // Try the next subkey
     }
 
     const int MAX_CHAR_COUNT = 256;
     DWORD valueBufSize = MAX_CHAR_COUNT * sizeof(WCHAR);
     WCHAR name[MAX_CHAR_COUNT] = { L'\0' };
     WCHAR issuer[MAX_CHAR_COUNT] = { L'\0' };
 
     // Get the name from the registry
     retCode = RegQueryValueExW(subKey, L"name", 0, NULL, 
                                (LPBYTE)name, &valueBufSize);
     if (retCode != ERROR_SUCCESS) {
-      LOG(("Could not obtain name from registry: %d\n", retCode));
+      LOG_WARN(("Could not obtain name from registry.  (%d)", retCode));
       continue; // Try the next subkey
     }
 
     // Get the issuer from the registry
     valueBufSize = MAX_CHAR_COUNT * sizeof(WCHAR);
     retCode = RegQueryValueExW(subKey, L"issuer", 0, NULL, 
                                (LPBYTE)issuer, &valueBufSize);
     if (retCode != ERROR_SUCCESS) {
-      LOG(("Could not obtain issuer from registry: %d\n", retCode));
+      LOG_WARN(("Could not obtain issuer from registry.  (%d)", retCode));
       continue; // Try the next subkey
     }
 
     CertificateCheckInfo allowedCertificate = {
       name, 
       issuer, 
     };
 
     retCode = CheckCertificateForPEFile(filePath, allowedCertificate);
     if (retCode != ERROR_SUCCESS) {
-      LOG(("Error on certificate check: %d\n", retCode));
+      LOG_WARN(("Error on certificate check.  (%d)", retCode));
       continue; // Try the next subkey
     }
 
     retCode = VerifyCertificateTrustForFile(filePath);
     if (retCode != ERROR_SUCCESS) {
-      LOG(("Error on certificate trust check: %d\n", retCode));
+      LOG_WARN(("Error on certificate trust check.  (%d)", retCode));
       continue; // Try the next subkey
     }
 
     // Raise the roof, we found a match!
     return TRUE; 
   }
   
   // No certificates match, :'(
--- a/toolkit/components/maintenanceservice/serviceinstall.cpp
+++ b/toolkit/components/maintenanceservice/serviceinstall.cpp
@@ -63,28 +63,28 @@ ReadMaintenanceServiceStrings(LPCWSTR pa
 static BOOL
 GetVersionNumberFromPath(LPWSTR path, DWORD &A, DWORD &B, 
                          DWORD &C, DWORD &D) 
 {
   DWORD fileVersionInfoSize = GetFileVersionInfoSizeW(path, 0);
   nsAutoArrayPtr<char> fileVersionInfo = new char[fileVersionInfoSize];
   if (!GetFileVersionInfoW(path, 0, fileVersionInfoSize,
                            fileVersionInfo.get())) {
-      LOG(("Could not obtain file info of old service.  (%d)\n", 
-           GetLastError()));
+      LOG_WARN(("Could not obtain file info of old service.  (%d)", 
+                GetLastError()));
       return FALSE;
   }
 
   VS_FIXEDFILEINFO *fixedFileInfo = 
     reinterpret_cast<VS_FIXEDFILEINFO *>(fileVersionInfo.get());
   UINT size;
   if (!VerQueryValueW(fileVersionInfo.get(), L"\\", 
     reinterpret_cast<LPVOID*>(&fixedFileInfo), &size)) {
-      LOG(("Could not query file version info of old service.  (%d)\n", 
-           GetLastError()));
+      LOG_WARN(("Could not query file version info of old service.  (%d)", 
+                GetLastError()));
       return FALSE;
   }  
 
   A = HIWORD(fixedFileInfo->dwFileVersionMS);
   B = LOWORD(fixedFileInfo->dwFileVersionMS);
   C = HIWORD(fixedFileInfo->dwFileVersionLS);
   D = LOWORD(fixedFileInfo->dwFileVersionLS);
   return TRUE;
@@ -100,68 +100,68 @@ GetVersionNumberFromPath(LPWSTR path, DW
 */
 BOOL
 UpdateServiceDescription(SC_HANDLE serviceHandle)
 {
   WCHAR updaterINIPath[MAX_PATH + 1];
   if (!GetModuleFileNameW(NULL, updaterINIPath, 
                           sizeof(updaterINIPath) /
                           sizeof(updaterINIPath[0]))) {
-    LOG(("Could not obtain module filename when attempting to "
-         "modify service description. (%d)\n", GetLastError()));
+    LOG_WARN(("Could not obtain module filename when attempting to "
+              "modify service description.  (%d)", GetLastError()));
     return FALSE;
   }
 
   if (!PathRemoveFileSpecW(updaterINIPath)) {
-    LOG(("Could not remove file spec when attempting to "
-         "modify service description. (%d)\n", GetLastError()));
+    LOG_WARN(("Could not remove file spec when attempting to "
+              "modify service description.  (%d)", GetLastError()));
     return FALSE;
   }
 
   if (!PathAppendSafe(updaterINIPath, L"updater.ini")) {
-    LOG(("Could not append updater.ini filename when attempting to "
-         "modify service description. (%d)\n", GetLastError()));
+    LOG_WARN(("Could not append updater.ini filename when attempting to "
+              "modify service description.  (%d)", GetLastError()));
     return FALSE;
   }
 
   if (GetFileAttributesW(updaterINIPath) == INVALID_FILE_ATTRIBUTES) {
-    LOG(("updater.ini file does not exist, will not modify "
-         "service description. (%d)\n", GetLastError()));
+    LOG_WARN(("updater.ini file does not exist, will not modify "
+              "service description.  (%d)", GetLastError()));
     return FALSE;
   }
   
   MaintenanceServiceStringTable serviceStrings;
   int rv = ReadMaintenanceServiceStrings(updaterINIPath, &serviceStrings);
   if (rv != OK || !strlen(serviceStrings.serviceDescription)) {
-    LOG(("updater.ini file does not contain a maintenance "
-         "service description.\n"));
+    LOG_WARN(("updater.ini file does not contain a maintenance "
+              "service description."));
     return FALSE;
   }
 
   WCHAR serviceDescription[MAX_TEXT_LEN];
   if (!MultiByteToWideChar(CP_UTF8, 0, 
                            serviceStrings.serviceDescription, -1,
                            serviceDescription,
                            sizeof(serviceDescription) / 
                            sizeof(serviceDescription[0]))) {
-    LOG(("Could not convert description to wide string format (%d)\n", 
-         GetLastError()));
+    LOG_WARN(("Could not convert description to wide string format.  (%d)",
+              GetLastError()));
     return FALSE;
   }
 
   SERVICE_DESCRIPTIONW descriptionConfig;
   descriptionConfig.lpDescription = serviceDescription;
   if (!ChangeServiceConfig2W(serviceHandle, 
                              SERVICE_CONFIG_DESCRIPTION, 
                              &descriptionConfig)) {
-    LOG(("Could not change service config (%d)\n", GetLastError()));
+    LOG_WARN(("Could not change service config.  (%d)", GetLastError()));
     return FALSE;
   }
 
-  LOG(("The service description was updated successfully.\n"));
+  LOG(("The service description was updated successfully."));
   return TRUE;
 }
 
 /**
  * Determines if the MozillaMaintenance service path needs to be updated
  * and fixes it if it is wrong.
  *
  * @param service             A handle to the service to fix.
@@ -178,45 +178,46 @@ FixServicePath(SC_HANDLE service,
   // would uninstall the service on each upgrade.  This had an
   // intermittent error which could cause the service to use the file
   // maintenanceservice_tmp.exe as the install path.  Only a small number
   // of Nightly users would be affected by this, but we check for this
   // state here and fix the user if they are affected.
   bool doesServiceHaveCorrectPath =
     !wcsstr(currentServicePath, L"maintenanceservice_tmp.exe");
   if (doesServiceHaveCorrectPath) {
-    LOG(("The MozillaMaintenance service path is correct.\n"));
+    LOG(("The MozillaMaintenance service path is correct."));
     servicePathWasWrong = FALSE;
     return TRUE;
   }
-  LOG(("The MozillaMaintenance path is NOT correct.\n"));
+  // This is a recoverable situation so not logging as a warning
+  LOG(("The MozillaMaintenance path is NOT correct."));
   servicePathWasWrong = TRUE;
 
   WCHAR fixedPath[MAX_PATH + 1] = { L'\0' };
   wcsncpy(fixedPath, currentServicePath, MAX_PATH);
   PathUnquoteSpacesW(fixedPath);
   if (!PathRemoveFileSpecW(fixedPath)) {
-    LOG(("Couldn't remove file spec. (%d)\n", GetLastError()));
+    LOG_WARN(("Couldn't remove file spec.  (%d)", GetLastError()));
     return FALSE;
   }
   if (!PathAppendSafe(fixedPath, L"maintenanceservice.exe")) {
-    LOG(("Couldn't append file spec. (%d)\n", GetLastError()));
+    LOG_WARN(("Couldn't append file spec.  (%d)", GetLastError()));
     return FALSE;
   }
   PathQuoteSpacesW(fixedPath);
 
 
   if (!ChangeServiceConfigW(service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,
                             SERVICE_NO_CHANGE, fixedPath, NULL, NULL, NULL,
                             NULL, NULL, NULL)) {
-    LOG(("Could not fix service path. (%d)\n", GetLastError()));
+    LOG_WARN(("Could not fix service path.  (%d)", GetLastError()));
     return FALSE;
   }
 
-  LOG(("Fixed service path to: %ls.\n", fixedPath));
+  LOG(("Fixed service path to: %ls.", fixedPath));
   return TRUE;
 }
 
 /**
  * Installs or upgrades the SVC_NAME service.
  * If an existing service is already installed, we replace it with the
  * currently running process.
  *
@@ -225,94 +226,94 @@ FixServicePath(SC_HANDLE service,
  */
 BOOL
 SvcInstall(SvcInstallAction action)
 {
   // Get a handle to the local computer SCM database with full access rights.
   nsAutoServiceHandle schSCManager(OpenSCManager(NULL, NULL, 
                                                  SC_MANAGER_ALL_ACCESS));
   if (!schSCManager) {
-    LOG(("Could not open service manager.  (%d)\n", GetLastError()));
+    LOG_WARN(("Could not open service manager.  (%d)", GetLastError()));
     return FALSE;
   }
 
   WCHAR newServiceBinaryPath[MAX_PATH + 1];
   if (!GetModuleFileNameW(NULL, newServiceBinaryPath, 
                           sizeof(newServiceBinaryPath) / 
                           sizeof(newServiceBinaryPath[0]))) {
-    LOG(("Could not obtain module filename when attempting to "
-         "install service. (%d)\n",
-         GetLastError()));
+    LOG_WARN(("Could not obtain module filename when attempting to "
+              "install service.  (%d)",
+              GetLastError()));
     return FALSE;
   }
 
   // Check if we already have the service installed.
   nsAutoServiceHandle schService(OpenServiceW(schSCManager, 
                                               SVC_NAME, 
                                               SERVICE_ALL_ACCESS));
   DWORD lastError = GetLastError();
   if (!schService && ERROR_SERVICE_DOES_NOT_EXIST != lastError) {
     // The service exists but we couldn't open it
-    LOG(("Could not open service.  (%d)\n", GetLastError()));
+    LOG_WARN(("Could not open service.  (%d)", GetLastError()));
     return FALSE;
   }
   
   if (schService) {
     // The service exists but it may not have the correct permissions.
     // This could happen if the permissions were not set correctly originally
     // or have been changed after the installation.  This will reset the 
     // permissions back to allow limited user accounts.
     if (!SetUserAccessServiceDACL(schService)) {
-      LOG(("Could not reset security ACE on service handle. It might not be "
-           "possible to start the service. This error should never "
-           "happen.  (%d)\n", GetLastError()));
+      LOG_WARN(("Could not reset security ACE on service handle. It might not be "
+                "possible to start the service. This error should never "
+                "happen.  (%d)", GetLastError()));
     }
 
     // The service exists and we opened it
     DWORD bytesNeeded;
     if (!QueryServiceConfigW(schService, NULL, 0, &bytesNeeded) && 
         GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-      LOG(("Could not determine buffer size for query service config.  (%d)\n", 
-           GetLastError()));
+      LOG_WARN(("Could not determine buffer size for query service config.  (%d)",
+                GetLastError()));
       return FALSE;
     }
 
     // Get the service config information, in particular we want the binary 
     // path of the service.
     nsAutoArrayPtr<char> serviceConfigBuffer = new char[bytesNeeded];
     if (!QueryServiceConfigW(schService, 
         reinterpret_cast<QUERY_SERVICE_CONFIGW*>(serviceConfigBuffer.get()), 
         bytesNeeded, &bytesNeeded)) {
-      LOG(("Could open service but could not query service config.  (%d)\n", 
-           GetLastError()));
+      LOG_WARN(("Could open service but could not query service config.  (%d)",
+                GetLastError()));
       return FALSE;
     }
     QUERY_SERVICE_CONFIGW &serviceConfig = 
       *reinterpret_cast<QUERY_SERVICE_CONFIGW*>(serviceConfigBuffer.get());
 
     // Check if we need to fix the service path
     BOOL servicePathWasWrong;
     static BOOL alreadyCheckedFixServicePath = FALSE;
     if (!alreadyCheckedFixServicePath) {
       if (!FixServicePath(schService, serviceConfig.lpBinaryPathName,
                           servicePathWasWrong)) {
-        LOG(("Could not fix service path. This should never happen. (%d)\n",
-              GetLastError()));
+        LOG_WARN(("Could not fix service path. This should never happen.  (%d)",
+                  GetLastError()));
         // True is returned because the service is pointing to
         // maintenanceservice_tmp.exe so it actually was upgraded to the
         // newest installed service.
         return TRUE;
       } else if (servicePathWasWrong) {
         // Now that the path is fixed we should re-attempt the install.
         // This current process' image path is maintenanceservice_tmp.exe.
         // The service used to point to maintenanceservice_tmp.exe.
         // The service was just fixed to point to maintenanceservice.exe.
         // Re-attempting an install from scratch will work as normal.
         alreadyCheckedFixServicePath = TRUE;
-        LOG(("Restarting install action: %d\n", action));
+        LOG(("Restarting install action: %d", action));
         return SvcInstall(action);
       }
     }
 
     // Ensure the service path is not quoted. We own this memory and know it to
     // be large enough for the quoted path, so it is large enough for the
     // unquoted path.  This function cannot fail.
     PathUnquoteSpacesW(serviceConfig.lpBinaryPathName);
@@ -323,17 +324,17 @@ SvcInstall(SvcInstallAction action)
     DWORD existingA, existingB, existingC, existingD;
     DWORD newA, newB, newC, newD; 
     BOOL obtainedExistingVersionInfo = 
       GetVersionNumberFromPath(serviceConfig.lpBinaryPathName, 
                                existingA, existingB, 
                                existingC, existingD);
     if (!GetVersionNumberFromPath(newServiceBinaryPath, newA, 
                                  newB, newC, newD)) {
-      LOG(("Could not obtain version number from new path\n"));
+      LOG_WARN(("Could not obtain version number from new path"));
       return FALSE;
     }
 
     // Check if we need to replace the old binary with the new one
     // If we couldn't get the old version info then we assume we should 
     // replace it.
     if (ForceInstallSvc == action ||
         !obtainedExistingVersionInfo || 
@@ -349,31 +350,32 @@ SvcInstall(SvcInstallAction action)
 
       schService.reset();
       if (!StopService()) {
         return FALSE;
       }
 
       if (!wcscmp(newServiceBinaryPath, serviceConfig.lpBinaryPathName)) {
         LOG(("File is already in the correct location, no action needed for "
-             "upgrade.  The path is: \"%ls\"\n", newServiceBinaryPath));
+             "upgrade.  The path is: \"%ls\"", newServiceBinaryPath));
         return TRUE;
       }
 
       BOOL result = TRUE;
 
       // Attempt to copy the new binary over top the existing binary.
       // If there is an error we try to move it out of the way and then
       // copy it in.  First try the safest / easiest way to overwrite the file.
       if (!CopyFileW(newServiceBinaryPath, 
                      serviceConfig.lpBinaryPathName, FALSE)) {
-        LOG(("Could not overwrite old service binary file. "
-             "This should never happen, but if it does the next upgrade will "
-             "fix it, the service is not a critical component that needs to be "
-             "installed for upgrades to work. (%d)\n", GetLastError()));
+        LOG_WARN(("Could not overwrite old service binary file. "
+                  "This should never happen, but if it does the next "
+                  "upgrade will fix it, the service is not a critical "
+                  "component that needs to be installed for upgrades "
+                  "to work.  (%d)", GetLastError()));
 
         // We rename the last 3 filename chars in an unsafe way.  Manually
         // verify there are more than 3 chars for safe failure in MoveFileExW.
         const size_t len = wcslen(serviceConfig.lpBinaryPathName);
         if (len > 3) {
           // Calculate the temp file path that we're moving the file to. This 
           // is the same as the proper service path but with a .old extension.
           LPWSTR oldServiceBinaryTempPath = 
@@ -385,61 +387,61 @@ SvcInstall(SvcInstallAction action)
           // Move the current (old) service file to the temp path.
           if (MoveFileExW(serviceConfig.lpBinaryPathName, 
                           oldServiceBinaryTempPath, 
                           MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH)) {
             // The old binary is moved out of the way, copy in the new one.
             if (!CopyFileW(newServiceBinaryPath, 
                            serviceConfig.lpBinaryPathName, FALSE)) {
               // It is best to leave the old service binary in this condition.
-              LOG(("ERROR: The new service binary could not be copied in."
-                   " The service will not be upgraded.\n"));
+              LOG_WARN(("The new service binary could not be copied in."
+                        " The service will not be upgraded."));
               result = FALSE;
             } else {
               LOG(("The new service binary was copied in by first moving the"
-                   " old one out of the way.\n"));
+                   " old one out of the way."));
             }
 
             // Attempt to get rid of the old service temp path.
             if (DeleteFileW(oldServiceBinaryTempPath)) {
-              LOG(("The old temp service path was deleted: %ls.\n", 
+              LOG(("The old temp service path was deleted: %ls.",
                    oldServiceBinaryTempPath));
             } else {
               // The old temp path could not be removed.  It will be removed
               // the next time the user can't copy the binary in or on uninstall.
-              LOG(("WARNING: The old temp service path was not deleted.\n"));
+              LOG_WARN(("The old temp service path was not deleted."));
             }
           } else {
             // It is best to leave the old service binary in this condition.
-            LOG(("ERROR: Could not move old service file out of the way from:"
-                 " \"%ls\" to \"%ls\". Service will not be upgraded. (%d)\n", 
-                 serviceConfig.lpBinaryPathName, 
-                 oldServiceBinaryTempPath, GetLastError()));
+            LOG_WARN(("Could not move old service file out of the way from:"
+                      " \"%ls\" to \"%ls\". Service will not be upgraded.  (%d)",
+                      serviceConfig.lpBinaryPathName,
+                      oldServiceBinaryTempPath, GetLastError()));
             result = FALSE;
           }
           delete[] oldServiceBinaryTempPath;
         } else {
             // It is best to leave the old service binary in this condition.
-            LOG(("ERROR: Service binary path was less than 3, service will"
-                 " not be updated.  This should never happen.\n"));
+            LOG_WARN(("Service binary path was less than 3, service will"
+                      " not be updated.  This should never happen."));
             result = FALSE;
         }
       } else {
-        LOG(("The new service binary was copied in.\n"));
+        LOG(("The new service binary was copied in."));
       }
 
       // We made a copy of ourselves to the existing location.
       // The tmp file (the process of which we are executing right now) will be
       // left over.  Attempt to delete the file on the next reboot.
       if (MoveFileExW(newServiceBinaryPath, NULL, MOVEFILE_DELAY_UNTIL_REBOOT)) {
-        LOG(("Deleting the old file path on the next reboot: %ls.\n", 
+        LOG(("Deleting the old file path on the next reboot: %ls.",
              newServiceBinaryPath));
       } else {
-        LOG(("Call to delete the old file path failed: %ls.\n", 
-             newServiceBinaryPath));
+        LOG_WARN(("Call to delete the old file path failed: %ls.",
+                  newServiceBinaryPath));
       }
       
       return result;
     }
 
     // We don't need to copy ourselves to the existing location.
     // The tmp file (the process of which we are executing right now) will be
     // left over.  Attempt to delete the file on the next reboot.
@@ -459,27 +461,27 @@ SvcInstall(SvcInstallAction action)
   PathQuoteSpacesW(newServiceBinaryPath);
   // The service does not already exist so create the service as on demand
   schService.own(CreateServiceW(schSCManager, SVC_NAME, SVC_DISPLAY_NAME,
                                 SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
                                 SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,
                                 newServiceBinaryPath, NULL, NULL, NULL, 
                                 NULL, NULL));
   if (!schService) {
-    LOG(("Could not create Windows service. "
-         "This error should never happen since a service install "
-         "should only be called when elevated. (%d)\n", GetLastError()));
+    LOG_WARN(("Could not create Windows service. "
+              "This error should never happen since a service install "
+              "should only be called when elevated.  (%d)", GetLastError()));
     return FALSE;
   } 
 
   if (!SetUserAccessServiceDACL(schService)) {
-    LOG(("Could not set security ACE on service handle, the service will not "
-         "be able to be started from unelevated processes. "
-         "This error should never happen.  (%d)\n", 
-         GetLastError()));
+    LOG_WARN(("Could not set security ACE on service handle, the service will not "
+              "be able to be started from unelevated processes. "
+              "This error should never happen.  (%d)",
+              GetLastError()));
   }
 
   UpdateServiceDescription(schService);
 
   return TRUE;
 }
 
 /**
@@ -489,71 +491,71 @@ SvcInstall(SvcInstallAction action)
  */
 BOOL
 StopService()
 {
   // Get a handle to the local computer SCM database with full access rights.
   nsAutoServiceHandle schSCManager(OpenSCManager(NULL, NULL, 
                                                  SC_MANAGER_ALL_ACCESS));
   if (!schSCManager) {
-    LOG(("Could not open service manager.  (%d)\n", GetLastError()));
+    LOG_WARN(("Could not open service manager.  (%d)", GetLastError()));
     return FALSE;
   }
 
   // Open the service
   nsAutoServiceHandle schService(OpenServiceW(schSCManager, SVC_NAME, 
                                               SERVICE_ALL_ACCESS));
   if (!schService) {
-    LOG(("Could not open service.  (%d)\n", GetLastError()));
+    LOG_WARN(("Could not open service.  (%d)", GetLastError()));
     return FALSE;
   } 
 
-  LOG(("Sending stop request...\n"));
+  LOG(("Sending stop request..."));
   SERVICE_STATUS status;
   SetLastError(ERROR_SUCCESS);
   if (!ControlService(schService, SERVICE_CONTROL_STOP, &status) &&
       GetLastError() != ERROR_SERVICE_NOT_ACTIVE) {
-    LOG(("Error sending stop request: %d\n", GetLastError()));
+    LOG_WARN(("Error sending stop request.  (%d)", GetLastError()));
   }
 
   schSCManager.reset();
   schService.reset();
 
-  LOG(("Waiting for service stop...\n"));
+  LOG(("Waiting for service stop..."));
   DWORD lastState = WaitForServiceStop(SVC_NAME, 30);
 
   // The service can be in a stopped state but the exe still in use
   // so make sure the process is really gone before proceeding
   WaitForProcessExit(L"maintenanceservice.exe", 30);
-  LOG(("Done waiting for service stop, last service state: %d\n", lastState));
+  LOG(("Done waiting for service stop, last service state: %d", lastState));
 
   return lastState == SERVICE_STOPPED;
 }
 
 /**
  * Uninstalls the Maintenance service.
  *
  * @return TRUE if successful.
  */
 BOOL
 SvcUninstall()
 {
   // Get a handle to the local computer SCM database with full access rights.
   nsAutoServiceHandle schSCManager(OpenSCManager(NULL, NULL, 
                                                  SC_MANAGER_ALL_ACCESS));
   if (!schSCManager) {
-    LOG(("Could not open service manager.  (%d)\n", GetLastError()));
+    LOG_WARN(("Could not open service manager.  (%d)", GetLastError()));
     return FALSE;
   }
 
   // Open the service
   nsAutoServiceHandle schService(OpenServiceW(schSCManager, SVC_NAME, 
                                               SERVICE_ALL_ACCESS));
   if (!schService) {
-    LOG(("Could not open service.  (%d)\n", GetLastError()));
+    LOG_WARN(("Could not open service.  (%d)", GetLastError()));
     return FALSE;
   } 
 
   //Stop the service so it deletes faster and so the uninstaller
   // can actually delete its EXE.
   DWORD totalWaitTime = 0;
   SERVICE_STATUS status;
   static const int maxWaitTime = 1000 * 60; // Never wait more than a minute
@@ -611,112 +613,112 @@ DWORD
 SetUserAccessServiceDACL(SC_HANDLE hService, PACL &pNewAcl, 
                          PSECURITY_DESCRIPTOR psd)
 {
   // Get the current security descriptor needed size
   DWORD needed = 0;
   if (!QueryServiceObjectSecurity(hService, DACL_SECURITY_INFORMATION, 
                                   &psd, 0, &needed)) {
     if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
-      LOG(("Warning: Could not query service object security size.  (%d)\n", 
-           GetLastError()));
+      LOG_WARN(("Could not query service object security size.  (%d)",
+                GetLastError()));
       return GetLastError();
     }
 
     DWORD size = needed;
     psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, size);
     if (!psd) {
-      LOG(("Warning: Could not allocate security descriptor.  (%d)\n", 
-           GetLastError()));
+      LOG_WARN(("Could not allocate security descriptor.  (%d)",
+                GetLastError()));
       return ERROR_INSUFFICIENT_BUFFER;
     }
 
     // Get the actual security descriptor now
     if (!QueryServiceObjectSecurity(hService, DACL_SECURITY_INFORMATION, 
                                     psd, size, &needed)) {
-      LOG(("Warning: Could not allocate security descriptor.  (%d)\n", 
-           GetLastError()));
+      LOG_WARN(("Could not allocate security descriptor.  (%d)",
+                GetLastError()));
       return GetLastError();
     }
   }
 
   // Get the current DACL from the security descriptor.
   PACL pacl = NULL;
   BOOL bDaclPresent = FALSE;
   BOOL bDaclDefaulted = FALSE;
   if ( !GetSecurityDescriptorDacl(psd, &bDaclPresent, &pacl, 
                                   &bDaclDefaulted)) {
-    LOG(("Warning: Could not obtain DACL.  (%d)\n", GetLastError()));
+    LOG_WARN(("Could not obtain DACL.  (%d)", GetLastError()));
     return GetLastError();
   }
 
   PSID sid;
   DWORD SIDSize = SECURITY_MAX_SID_SIZE;
   sid = LocalAlloc(LMEM_FIXED, SIDSize);
   if (!sid) {
-    LOG(("Could not allocate SID memory.  (%d)\n", GetLastError()));
+    LOG_WARN(("Could not allocate SID memory.  (%d)", GetLastError()));
     return GetLastError();
   }
 
   if (!CreateWellKnownSid(WinBuiltinUsersSid, NULL, sid, &SIDSize)) {
     DWORD lastError = GetLastError();
-    LOG(("Could not create well known SID.  (%d)\n", lastError));
+    LOG_WARN(("Could not create well known SID.  (%d)", lastError));
     LocalFree(sid);
     return lastError;
   }
 
   // Lookup the account name, the function fails if you don't pass in
   // a buffer for the domain name but it's not used since we're using
   // the built in account Sid.
   SID_NAME_USE accountType;
   WCHAR accountName[UNLEN + 1];
   WCHAR domainName[DNLEN + 1];
   DWORD accountNameSize = UNLEN + 1;
   DWORD domainNameSize = DNLEN + 1;
   if (!LookupAccountSidW(NULL, sid, accountName, 
                          &accountNameSize, 
                          domainName, &domainNameSize, &accountType)) {
-    LOG(("Warning: Could not lookup account Sid, will try Users.  (%d)\n",
-         GetLastError()));
+    LOG_WARN(("Could not lookup account Sid, will try Users.  (%d)",
+              GetLastError()));
     wcscpy(accountName, L"Users");
   }
 
   // We already have the group name so we can get rid of the SID
   FreeSid(sid);
   sid = NULL;
 
   // Build the ACE, BuildExplicitAccessWithName cannot fail so it is not logged.
   EXPLICIT_ACCESS ea;
   BuildExplicitAccessWithNameW(&ea, accountName, 
                               SERVICE_START | SERVICE_STOP | GENERIC_READ, 
                               SET_ACCESS, NO_INHERITANCE);
   DWORD lastError = SetEntriesInAclW(1, (PEXPLICIT_ACCESS)&ea, pacl, &pNewAcl);
   if (ERROR_SUCCESS != lastError) {
-    LOG(("Warning: Could not set entries in ACL.  (%d)\n", lastError));
+    LOG_WARN(("Could not set entries in ACL.  (%d)", lastError));
     return lastError;
   }
 
   // Initialize a new security descriptor.
   SECURITY_DESCRIPTOR sd;
   if (!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION)) {
-    LOG(("Warning: Could not initialize security descriptor.  (%d)\n", 
-         GetLastError()));
+    LOG_WARN(("Could not initialize security descriptor.  (%d)",
+              GetLastError()));
     return GetLastError();
   }
 
   // Set the new DACL in the security descriptor.
   if (!SetSecurityDescriptorDacl(&sd, TRUE, pNewAcl, FALSE)) {
-    LOG(("Warning: Could not set security descriptor DACL.  (%d)\n", 
-         GetLastError()));
+    LOG_WARN(("Could not set security descriptor DACL.  (%d)",
+              GetLastError()));
     return GetLastError();
   }
 
   // Set the new security descriptor for the service object.
   if (!SetServiceObjectSecurity(hService, DACL_SECURITY_INFORMATION, &sd)) {
-    LOG(("Warning: Could not set object security.  (%d)\n", 
-         GetLastError()));
+    LOG_WARN(("Could not set object security.  (%d)",
+              GetLastError()));
     return GetLastError();
   }
 
   // Woohoo, raise the roof
-  LOG(("User access was set successfully on the service.\n"));
+  LOG(("User access was set successfully on the service."));
   return ERROR_SUCCESS;
 }
--- a/toolkit/components/maintenanceservice/workmonitor.cpp
+++ b/toolkit/components/maintenanceservice/workmonitor.cpp
@@ -45,39 +45,39 @@ BOOL PathGetSiblingFilePath(LPWSTR desti
 */
 static BOOL
 IsStatusApplying(LPCWSTR updateDirPath, BOOL &isApplying)
 {
   isApplying = FALSE;
   WCHAR updateStatusFilePath[MAX_PATH + 1];
   wcscpy(updateStatusFilePath, updateDirPath);
   if (!PathAppendSafe(updateStatusFilePath, L"update.status")) {
-    LOG(("Warning: Could not append path for update.status file\n"));
+    LOG_WARN(("Could not append path for update.status file"));
     return FALSE;
   }
 
   nsAutoHandle statusFile(CreateFileW(updateStatusFilePath, GENERIC_READ,
                                       FILE_SHARE_READ | 
                                       FILE_SHARE_WRITE | 
                                       FILE_SHARE_DELETE,
                                       NULL, OPEN_EXISTING, 0, NULL));
 
   if (INVALID_HANDLE_VALUE == statusFile) {
-    LOG(("Warning: Could not open update.status file\n"));
+    LOG_WARN(("Could not open update.status file"));
     return FALSE;
   }
 
   char buf[32] = { 0 };
   DWORD read;
   if (!ReadFile(statusFile, buf, sizeof(buf), &read, NULL)) {
-    LOG(("Warning: Could not read from update.status file\n"));
+    LOG_WARN(("Could not read from update.status file"));
     return FALSE;
   }
 
-  LOG(("updater.exe returned status: %s\n", buf));
+  LOG(("updater.exe returned status: %s", buf));
 
   const char kApplying[] = "applying";
   isApplying = strncmp(buf, kApplying, 
                        sizeof(kApplying) - 1) == 0;
   return TRUE;
 }
 
 /**
@@ -131,17 +131,17 @@ GetInstallationDir(int argcTmp, LPWSTR *
  * @return TRUE if the update process was run had a return code of 0.
  */
 BOOL
 StartUpdateProcess(int argc,
                    LPWSTR *argv,
                    LPCWSTR installDir,
                    BOOL &processStarted)
 {
-  LOG(("Starting update process as the service in session 0.\n"));
+  LOG(("Starting update process as the service in session 0."));
   STARTUPINFO si = {0};
   si.cb = sizeof(STARTUPINFO);
   si.lpDesktop = L"winsta0\\Default";
   PROCESS_INFORMATION pi = {0};
 
   // The updater command line is of the form:
   // updater.exe update-dir apply [wait-pid [callback-dir callback-path args]]
   LPWSTR cmdLine = MakeCommandLine(argc, argv);
@@ -173,77 +173,77 @@ StartUpdateProcess(int argc,
     selfHandlePostUpdate = MoveFileExW(updaterINI, updaterINITemp, 
                                        MOVEFILE_REPLACE_EXISTING);
   }
 
   // Add an env var for MOZ_USING_SERVICE so the updater.exe can
   // do anything special that it needs to do for service updates.
   // Search in updater.cpp for more info on MOZ_USING_SERVICE.
   putenv(const_cast<char*>("MOZ_USING_SERVICE=1"));
-  LOG(("Starting service with cmdline: %ls\n", cmdLine));
+  LOG(("Starting service with cmdline: %ls", cmdLine));
   processStarted = CreateProcessW(argv[0], cmdLine, 
                                   NULL, NULL, FALSE, 
                                   CREATE_DEFAULT_ERROR_MODE, 
                                   NULL, 
                                   NULL, &si, &pi);
   // Empty value on putenv is how you remove an env variable in Windows
   putenv(const_cast<char*>("MOZ_USING_SERVICE="));
   
   BOOL updateWasSuccessful = FALSE;
   if (processStarted) {
     // Wait for the updater process to finish
-    LOG(("Process was started... waiting on result.\n")); 
+    LOG(("Process was started... waiting on result."));
     DWORD waitRes = WaitForSingleObject(pi.hProcess, TIME_TO_WAIT_ON_UPDATER);
     if (WAIT_TIMEOUT == waitRes) {
       // We waited a long period of time for updater.exe and it never finished
       // so kill it.
       TerminateProcess(pi.hProcess, 1);
     } else {
       // Check the return code of updater.exe to make sure we get 0
       DWORD returnCode;
       if (GetExitCodeProcess(pi.hProcess, &returnCode)) {
-        LOG(("Process finished with return code %d.\n", returnCode)); 
+        LOG(("Process finished with return code %d.", returnCode));
         // updater returns 0 if successful.
         updateWasSuccessful = (returnCode == 0);
       } else {
-        LOG(("Process finished but could not obtain return code.\n")); 
+        LOG_WARN(("Process finished but could not obtain return code."));
       }
     }
     CloseHandle(pi.hProcess);
     CloseHandle(pi.hThread);
 
     // Check just in case updater.exe didn't change the status from
     // applying.  If this is the case we report an error.
     BOOL isApplying = FALSE;
     if (IsStatusApplying(argv[1], isApplying) && isApplying) {
       if (updateWasSuccessful) {
         LOG(("update.status is still applying even know update "
-             " was successful.\n"));
+             " was successful."));
         if (!WriteStatusFailure(argv[1], 
                                 SERVICE_STILL_APPLYING_ON_SUCCESS)) {
-          LOG(("Could not write update.status still applying on"
-               " success error.\n"));
+          LOG_WARN(("Could not write update.status still applying on"
+                    " success error."));
         }
         // Since we still had applying we know updater.exe didn't do its
         // job correctly.
         updateWasSuccessful = FALSE;
       } else {
-        LOG(("update.status is still applying and update was not successful.\n"));
+        LOG_WARN(("update.status is still applying and update was not successful."));
         if (!WriteStatusFailure(argv[1], 
                                 SERVICE_STILL_APPLYING_ON_FAILURE)) {
-          LOG(("Could not write update.status still applying on"
-               " success error.\n"));
+          LOG_WARN(("Could not write update.status still applying on"
+                    " success error."));
         }
       }
     }
   } else {
     DWORD lastError = GetLastError();
-    LOG(("Could not create process as current user, "
-         "updaterPath: %ls; cmdLine: %l.  (%d)\n", 
-         argv[0], cmdLine, lastError));
+    LOG_WARN(("Could not create process as current user, "
+              "updaterPath: %ls; cmdLine: %ls.  (%d)",
+              argv[0], cmdLine, lastError));
   }
 
   // Now that we're done with the update, restore back the updater.ini file
   // We use it ourselves, and also we want it back in case we had any type 
   // of error so that the normal update process can use it.
   if (selfHandlePostUpdate) {
     MoveFileExW(updaterINITemp, updaterINI, MOVEFILE_REPLACE_EXISTING);
 
@@ -258,21 +258,21 @@ StartUpdateProcess(int argc,
       // The PostUpdate process with user only access will be done inside
       // the unelevated updater.exe after the update process is complete
       // from the service.  We don't know here which session to start
       // the user PostUpdate process from.
       // Note that we don't need to do this if we're just staging the
       // update in the background, as the PostUpdate step runs when
       // performing the replacing in that case.
       if (!backgroundUpdate) {
-        LOG(("Launching post update process as the service in session 0.\n"));
+        LOG(("Launching post update process as the service in session 0."));
         if (!LaunchWinPostProcess(installDir, updateInfoDir, true, NULL)) {
-          LOG(("The post update process could not be launched."
-               " installDir: %ls, updateInfoDir: %ls\n",
-               installDir, updateInfoDir));
+          LOG_WARN(("The post update process could not be launched."
+                    " installDir: %ls, updateInfoDir: %ls",
+                    installDir, updateInfoDir));
         }
       }
     }
   }
 
   free(cmdLine);
   return updateWasSuccessful;
 }
@@ -285,188 +285,188 @@ StartUpdateProcess(int argc,
  *                        argv[0] must be the path to updater.exe
  * @return TRUE if the update was successful.
  */
 BOOL
 ProcessSoftwareUpdateCommand(DWORD argc, LPWSTR *argv)
 {
   BOOL result = TRUE;
   if (argc < 3) {
-    LOG(("Not enough command line parameters specified. "
-         "Updating update.status.\n"));
+    LOG_WARN(("Not enough command line parameters specified. "
+              "Updating update.status."));
 
     // We can only update update.status if argv[1] exists.  argv[1] is
     // the directory where the update.status file exists.
     if (argc < 2 || 
         !WriteStatusFailure(argv[1], 
                             SERVICE_NOT_ENOUGH_COMMAND_LINE_ARGS)) {
-      LOG(("Could not write update.status service update failure."
-           "Last error: %d\n", GetLastError()));
+      LOG_WARN(("Could not write update.status service update failure.  (%d)",
+                GetLastError()));
     }
     return FALSE;
   }
 
   WCHAR installDir[MAX_PATH] = {L'\0'};
   if (!GetInstallationDir(argc, argv, installDir)) {
-    LOG(("Could not get the installation directory"));
+    LOG_WARN(("Could not get the installation directory"));
     if (!WriteStatusFailure(argv[1],
                             SERVICE_INSTALLDIR_ERROR)) {
-      LOG(("Could not write update.status for GetInstallationDir failure.\n"));
+      LOG_WARN(("Could not write update.status for GetInstallationDir failure."));
     }
     return FALSE;
   }
 
   // Make sure the path to the updater to use for the update is local.
   // We do this check to make sure that file locking is available for
   // race condition security checks.
   BOOL isLocal = FALSE;
   if (!IsLocalFile(argv[0], isLocal) || !isLocal) {
-    LOG(("Filesystem in path %ls is not supported"
-         "Last error: %d\n", argv[0], GetLastError()));
+    LOG_WARN(("Filesystem in path %ls is not supported (%d)",
+              argv[0], GetLastError()));
     if (!WriteStatusFailure(argv[1], 
                             SERVICE_UPDATER_NOT_FIXED_DRIVE)) {
-      LOG(("Could not write update.status service update failure."
-           "Last error: %d\n", GetLastError()));
+      LOG_WARN(("Could not write update.status service update failure.  (%d)",
+                GetLastError()));
     }
     return FALSE;
   }
 
   nsAutoHandle noWriteLock(CreateFileW(argv[0], GENERIC_READ, FILE_SHARE_READ, 
                                        NULL, OPEN_EXISTING, 0, NULL));
   if (INVALID_HANDLE_VALUE == noWriteLock) {
-      LOG(("Could not set no write sharing access on file."
-           "Last error: %d\n", GetLastError()));
+      LOG_WARN(("Could not set no write sharing access on file.  (%d)",
+                GetLastError()));
     if (!WriteStatusFailure(argv[1], 
                             SERVICE_COULD_NOT_LOCK_UPDATER)) {
-      LOG(("Could not write update.status service update failure."
-           "Last error: %d\n", GetLastError()));
+      LOG_WARN(("Could not write update.status service update failure.  (%d)",
+                GetLastError()));
     }
     return FALSE;
   }
 
   // Verify that the updater.exe that we are executing is the same
   // as the one in the installation directory which we are updating.
   // The installation dir that we are installing to is installDir.
   WCHAR installDirUpdater[MAX_PATH + 1] = {L'\0'};
   wcsncpy(installDirUpdater, installDir, MAX_PATH);
   if (!PathAppendSafe(installDirUpdater, L"updater.exe")) {
-    LOG(("Install directory updater could not be determined.\n"));
+    LOG_WARN(("Install directory updater could not be determined."));
     result = FALSE;
   }
 
   BOOL updaterIsCorrect;
   if (result && !VerifySameFiles(argv[0], installDirUpdater, 
                                  updaterIsCorrect)) {
-    LOG(("Error checking if the updaters are the same.\n"
-         "Path 1: %ls\nPath 2: %ls\n", argv[0], installDirUpdater));
+    LOG_WARN(("Error checking if the updaters are the same.\n"
+              "Path 1: %ls\nPath 2: %ls", argv[0], installDirUpdater));
     result = FALSE;
   }
 
   if (result && !updaterIsCorrect) {
-    LOG(("The updaters do not match, udpater will not run.\n")); 
+    LOG_WARN(("The updaters do not match, udpater will not run.")); 
     result = FALSE;
   }
 
   if (result) {
     LOG(("updater.exe was compared successfully to the installation directory"
-         " updater.exe.\n"));
+         " updater.exe."));
   } else {
     if (!WriteStatusFailure(argv[1], 
                             SERVICE_UPDATER_COMPARE_ERROR)) {
-      LOG(("Could not write update.status updater compare failure.\n"));
+      LOG_WARN(("Could not write update.status updater compare failure."));
     }
     return FALSE;
   }
 
   // Check to make sure the udpater.exe module has the unique updater identity.
   // This is a security measure to make sure that the signed executable that
   // we will run is actually an updater.
   HMODULE updaterModule = LoadLibraryEx(argv[0], NULL, 
                                         LOAD_LIBRARY_AS_DATAFILE);
   if (!updaterModule) {
-    LOG(("updater.exe module could not be loaded. (%d)\n", GetLastError()));
+    LOG_WARN(("updater.exe module could not be loaded. (%d)", GetLastError()));
     result = FALSE;
   } else {
     char updaterIdentity[64];
     if (!LoadStringA(updaterModule, IDS_UPDATER_IDENTITY, 
                      updaterIdentity, sizeof(updaterIdentity))) {
-      LOG(("The updater.exe application does not contain the Mozilla"
-           " updater identity.\n"));
+      LOG_WARN(("The updater.exe application does not contain the Mozilla"
+                " updater identity."));
       result = FALSE;
     }
 
     if (strcmp(updaterIdentity, UPDATER_IDENTITY_STRING)) {
-      LOG(("The updater.exe identity string is not valid.\n"));
+      LOG_WARN(("The updater.exe identity string is not valid."));
       result = FALSE;
     }
     FreeLibrary(updaterModule);
   }
 
   if (result) {
     LOG(("The updater.exe application contains the Mozilla"
-          " updater identity.\n"));
+          " updater identity."));
   } else {
     if (!WriteStatusFailure(argv[1], 
                             SERVICE_UPDATER_IDENTITY_ERROR)) {
-      LOG(("Could not write update.status no updater identity.\n"));
+      LOG_WARN(("Could not write update.status no updater identity."));
     }
     return TRUE;
   }
 
   // Check for updater.exe sign problems
   BOOL updaterSignProblem = FALSE;
 #ifndef DISABLE_UPDATER_AUTHENTICODE_CHECK
   updaterSignProblem = !DoesBinaryMatchAllowedCertificates(installDir,
                                                            argv[0]);
 #endif
 
   // Only proceed with the update if we have no signing problems
   if (!updaterSignProblem) {
     BOOL updateProcessWasStarted = FALSE;
     if (StartUpdateProcess(argc, argv, installDir,
                            updateProcessWasStarted)) {
-      LOG(("updater.exe was launched and run successfully!\n"));
+      LOG(("updater.exe was launched and run successfully!"));
       LogFlush();
 
       // Don't attempt to update the service when the update is being staged.
       if (!IsUpdateBeingStaged(argc, argv)) {
         // We might not execute code after StartServiceUpdate because
         // the service installer will stop the service if it is running.
         StartServiceUpdate(installDir);
       }
     } else {
       result = FALSE;
-      LOG(("Error running update process. Updating update.status"
-           " Last error: %d\n", GetLastError()));
+      LOG_WARN(("Error running update process. Updating update.status  (%d)",
+                GetLastError()));
       LogFlush();
 
       // If the update process was started, then updater.exe is responsible for
       // setting the failure code.  If it could not be started then we do the 
       // work.  We set an error instead of directly setting status pending 
       // so that the app.update.service.errors pref can be updated when 
       // the callback app restarts.
       if (!updateProcessWasStarted) {
         if (!WriteStatusFailure(argv[1], 
                                 SERVICE_UPDATER_COULD_NOT_BE_STARTED)) {
-          LOG(("Could not write update.status service update failure."
-               "Last error: %d\n", GetLastError()));
+          LOG_WARN(("Could not write update.status service update failure.  (%d)",
+                    GetLastError()));
         }
       }
     }
   } else {
     result = FALSE;
-    LOG(("Could not start process due to certificate check error on "
-         "updater.exe. Updating update.status.  Last error: %d\n", GetLastError()));
+    LOG_WARN(("Could not start process due to certificate check error on "
+              "updater.exe. Updating update.status.  (%d)", GetLastError()));
 
     // When there is a certificate check error on the updater.exe application,
     // we want to write out the error.
     if (!WriteStatusFailure(argv[1], 
                             SERVICE_UPDATER_SIGN_ERROR)) {
-      LOG(("Could not write pending state to update.status.  (%d)\n", 
-           GetLastError()));
+      LOG_WARN(("Could not write pending state to update.status.  (%d)",
+                GetLastError()));
     }
   }
 
   return result;
 }
 
 /**
  * Executes a service command.
@@ -477,40 +477,40 @@ ProcessSoftwareUpdateCommand(DWORD argc,
  *             service command.
  *             
  * @return FALSE if there was an error executing the service command.
  */
 BOOL
 ExecuteServiceCommand(int argc, LPWSTR *argv)
 {
   if (argc < 3) {
-    LOG(("Not enough command line arguments to execute a service command\n"));
+    LOG_WARN(("Not enough command line arguments to execute a service command"));
     return FALSE;
   }
 
   // The tests work by making sure the log has changed, so we put a 
   // unique ID in the log.
   RPC_WSTR guidString = RPC_WSTR(L"");
   GUID guid;
   HRESULT hr = CoCreateGuid(&guid);
   if (SUCCEEDED(hr)) {
     UuidToString(&guid, &guidString);
   }
-  LOG(("Executing service command %ls, ID: %ls\n", 
+  LOG(("Executing service command %ls, ID: %ls",
        argv[2], reinterpret_cast<LPCWSTR>(guidString)));
   RpcStringFree(&guidString);
 
   BOOL result = FALSE;
   if (!lstrcmpi(argv[2], L"software-update")) {
     result = ProcessSoftwareUpdateCommand(argc - 3, argv + 3);
     // We might not reach here if the service install succeeded
     // because the service self updates itself and the service
     // installer will stop the service.
-    LOG(("Service command %ls complete.\n", argv[2]));
+    LOG(("Service command %ls complete.", argv[2]));
   } else {
-    LOG(("Service command not recognized: %ls.\n", argv[2]));
+    LOG_WARN(("Service command not recognized: %ls.", argv[2]));
     // result is already set to FALSE
   }
 
-  LOG(("service command %ls complete with result: %ls.\n", 
+  LOG(("service command %ls complete with result: %ls.",
        argv[1], (result ? L"Success" : L"Failure")));
   return TRUE;
 }
--- a/toolkit/mozapps/update/common/uachelper.cpp
+++ b/toolkit/mozapps/update/common/uachelper.cpp
@@ -161,30 +161,30 @@ UACHelper::DisableUnneededPrivileges(HAN
                                      LPCTSTR *unneededPrivs, 
                                      size_t count)
 {
   HANDLE obtainedToken = NULL;
   if (!token) {
     // Note: This handle is a pseudo-handle and need not be closed
     HANDLE process = GetCurrentProcess();
     if (!OpenProcessToken(process, TOKEN_ALL_ACCESS_P, &obtainedToken)) {
-      LOG(("Could not obtain token for current process, no "
-           "privileges changed. (%d)\n", GetLastError()));
+      LOG_WARN(("Could not obtain token for current process, no "
+                "privileges changed. (%d)", GetLastError()));
       return FALSE;
     }
     token = obtainedToken;
   }
 
   BOOL result = TRUE;
   for (size_t i = 0; i < count; i++) {
     if (SetPrivilege(token, unneededPrivs[i], FALSE)) {
-      LOG(("Disabled unneeded token privilege: %s.\n", 
+      LOG(("Disabled unneeded token privilege: %s.",
            unneededPrivs[i]));
     } else {
-      LOG(("Could not disable token privilege value: %s. (%d)\n", 
+      LOG(("Could not disable token privilege value: %s. (%d)",
            unneededPrivs[i], GetLastError()));
       result = FALSE;
     }
   }
 
   if (obtainedToken) {
     CloseHandle(obtainedToken);
   }
--- a/toolkit/mozapps/update/common/updatelogging.cpp
+++ b/toolkit/mozapps/update/common/updatelogging.cpp
@@ -51,19 +51,32 @@ void UpdateLog::Finish()
 void UpdateLog::Flush()
 {
   if (!logFP)
     return;
 
   fflush(logFP);
 }
 
-
 void UpdateLog::Printf(const char *fmt, ... )
 {
   if (!logFP)
     return;
 
   va_list ap;
   va_start(ap, fmt);
   vfprintf(logFP, fmt, ap);
+  fprintf(logFP, "\n");
   va_end(ap);
 }
+
+void UpdateLog::WarnPrintf(const char *fmt, ... )
+{
+  if (!logFP)
+    return;
+
+  va_list ap;
+  va_start(ap, fmt);
+  fprintf(logFP, "*** Warning: ");
+  vfprintf(logFP, fmt, ap);
+  fprintf(logFP, "***\n");
+  va_end(ap);
+}
--- a/toolkit/mozapps/update/common/updatelogging.h
+++ b/toolkit/mozapps/update/common/updatelogging.h
@@ -17,28 +17,30 @@ public:
     return primaryLog;
   }
 
   void Init(NS_tchar* sourcePath, const NS_tchar* fileName,
             const NS_tchar* alternateFileName, bool append);
   void Finish();
   void Flush();
   void Printf(const char *fmt, ... );
+  void WarnPrintf(const char *fmt, ... );
 
   ~UpdateLog()
   {
     Finish();
   }
 
 protected:
   UpdateLog();
   FILE *logFP;
   NS_tchar* sourcePath;
 };
 
+#define LOG_WARN(args) UpdateLog::GetPrimaryLog().WarnPrintf args
 #define LOG(args) UpdateLog::GetPrimaryLog().Printf args
 #define LogInit(PATHNAME_, FILENAME_) \
   UpdateLog::GetPrimaryLog().Init(PATHNAME_, FILENAME_, 0, false)
 #define LogInitAppend(PATHNAME_, FILENAME_, ALTERNATE_) \
   UpdateLog::GetPrimaryLog().Init(PATHNAME_, FILENAME_, ALTERNATE_, true)
 #define LogFinish() UpdateLog::GetPrimaryLog().Finish()
 #define LogFlush() UpdateLog::GetPrimaryLog().Flush()
 
--- a/toolkit/mozapps/update/updater/updater.cpp
+++ b/toolkit/mozapps/update/updater/updater.cpp
@@ -377,50 +377,50 @@ get_full_path(const NS_tchar *relpath)
  *         Whether the path is a directory path. Defaults to false.
  * @return valid filesystem path or NULL if the path checks fail.
  */
 static NS_tchar*
 get_valid_path(NS_tchar **line, bool isdir = false)
 {
   NS_tchar *path = mstrtok(kQuote, line);
   if (!path) {
-    LOG(("get_valid_path: unable to determine path: " LOG_S "\n", line));
+    LOG(("get_valid_path: unable to determine path: " LOG_S, line));
     return NULL;
   }
 
   // All paths must be relative from the current working directory
   if (path[0] == NS_T('/')) {
-    LOG(("get_valid_path: path must be relative: " LOG_S "\n", path));
+    LOG(("get_valid_path: path must be relative: " LOG_S, path));
     return NULL;
   }
 
 #ifdef XP_WIN
   // All paths must be relative from the current working directory
   if (path[0] == NS_T('\\') || path[1] == NS_T(':')) {
-    LOG(("get_valid_path: path must be relative: " LOG_S "\n", path));
+    LOG(("get_valid_path: path must be relative: " LOG_S, path));
     return NULL;
   }
 #endif
 
   if (isdir) {
     // Directory paths must have a trailing forward slash.
     if (path[NS_tstrlen(path) - 1] != NS_T('/')) {
       LOG(("get_valid_path: directory paths must have a trailing forward " \
-           "slash: " LOG_S "\n", path));
+           "slash: " LOG_S, path));
       return NULL;
     }
 
     // Remove the trailing forward slash because stat on Windows will return
     // ENOENT if the path has a trailing slash.
     path[NS_tstrlen(path) - 1] = NS_T('\0');
   }
 
   // Don't allow relative paths that resolve to a parent directory.
   if (NS_tstrstr(path, NS_T("..")) != NULL) {
-    LOG(("get_valid_path: paths must not contain '..': " LOG_S "\n", path));
+    LOG(("get_valid_path: paths must not contain '..': " LOG_S, path));
     return NULL;
   }
 
   return path;
 }
 
 static NS_tchar*
 get_quoted_path(const NS_tchar *path)
@@ -457,17 +457,17 @@ static void ensure_write_permissions(con
 #endif
 }
 
 static int ensure_remove(const NS_tchar *path)
 {
   ensure_write_permissions(path);
   int rv = NS_tremove(path);
   if (rv)
-    LOG(("ensure_remove: failed to remove file: " LOG_S ", rv: %d, err: %d\n",
+    LOG(("ensure_remove: failed to remove file: " LOG_S ", rv: %d, err: %d",
          path, rv, errno));
   return rv;
 }
 
 // Remove the directory pointed to by path and all of its files and sub-directories.
 static int ensure_remove_recursive(const NS_tchar *path)
 {
   // We use lstat rather than stat here so that we can successfully remove
@@ -482,18 +482,18 @@ static int ensure_remove_recursive(const
     return ensure_remove(path);
   }
 
   NS_tDIR *dir;
   NS_tdirent *entry;
 
   dir = NS_topendir(path);
   if (!dir) {
-    LOG(("ensure_remove_recursive: path is not a directory: " LOG_S ", rv: %d, err: %d\n",
-          path, rv, errno));
+    LOG(("ensure_remove_recursive: path is not a directory: " LOG_S ", rv: %d, err: %d",
+         path, rv, errno));
     return rv;
   }
 
   while ((entry = NS_treaddir(dir)) != 0) {
     if (NS_tstrcmp(entry->d_name, NS_T(".")) &&
         NS_tstrcmp(entry->d_name, NS_T(".."))) {
       NS_tchar childPath[MAXPATHLEN];
       NS_tsnprintf(childPath, sizeof(childPath)/sizeof(childPath[0]),
@@ -506,18 +506,18 @@ static int ensure_remove_recursive(const
   }
 
   NS_tclosedir(dir);
 
   if (rv == OK) {
     ensure_write_permissions(path);
     rv = NS_trmdir(path);
     if (rv) {
-      LOG(("ensure_remove_recursive: path is not a directory: " LOG_S ", rv: %d, err: %d\n",
-            path, rv, errno));
+      LOG(("ensure_remove_recursive: path is not a directory: " LOG_S ", rv: %d, err: %d",
+           path, rv, errno));
     }
   }
   return rv;
 }
 
 static bool is_read_only(const NS_tchar *flags)
 {
   size_t length = NS_tstrlen(flags);
@@ -574,17 +574,17 @@ static int ensure_parent_dir(const NS_tc
     *slash = NS_T('\0');
     rv = ensure_parent_dir(path);
     // Only attempt to create the directory if we're not at the root
     if (rv == OK && *path) {
       rv = NS_tmkdir(path, 0755);
       // If the directory already exists, then ignore the error.
       if (rv < 0 && errno != EEXIST) {
         LOG(("ensure_parent_dir: failed to create directory: " LOG_S ", " \
-             "err: %d\n", path, errno));
+             "err: %d", path, errno));
         rv = WRITE_ERROR;
       } else {
         rv = OK;
       }
     }
     *slash = NS_T('/');
   }
   return rv;
@@ -592,91 +592,91 @@ static int ensure_parent_dir(const NS_tc
 
 #ifdef XP_UNIX
 static int ensure_copy_symlink(const NS_tchar *path, const NS_tchar *dest)
 {
   // Copy symlinks by creating a new symlink to the same target
   NS_tchar target[MAXPATHLEN + 1] = {NS_T('\0')};
   int rv = readlink(path, target, MAXPATHLEN);
   if (rv == -1) {
-    LOG(("ensure_copy_symlink: failed to read the link: " LOG_S ", err: %d\n",
+    LOG(("ensure_copy_symlink: failed to read the link: " LOG_S ", err: %d",
          path, errno));
     return READ_ERROR;
   }
   rv = symlink(target, dest);
   if (rv == -1) {
-    LOG(("ensure_copy_symlink: failed to create the new link: " LOG_S ", target: " LOG_S " err: %d\n",
+    LOG(("ensure_copy_symlink: failed to create the new link: " LOG_S ", target: " LOG_S " err: %d",
          dest, target, errno));
     return READ_ERROR;
   }
   return 0;
 }
 #endif
 
 // Copy the file named path onto a new file named dest.
 static int ensure_copy(const NS_tchar *path, const NS_tchar *dest)
 {
 #ifdef XP_WIN
   // Fast path for Windows
   bool result = CopyFileW(path, dest, false);
   if (!result) {
-    LOG(("ensure_copy: failed to copy the file " LOG_S " over to " LOG_S ", lasterr: %x\n",
+    LOG(("ensure_copy: failed to copy the file " LOG_S " over to " LOG_S ", lasterr: %x",
          path, dest, GetLastError()));
     return WRITE_ERROR;
   }
   return 0;
 #else
   struct stat ss;
   int rv = NS_tlstat(path, &ss);
   if (rv) {
-    LOG(("ensure_copy: failed to read file status info: " LOG_S ", err: %d\n",
-          path, errno));
+    LOG(("ensure_copy: failed to read file status info: " LOG_S ", err: %d",
+         path, errno));
     return READ_ERROR;
   }
 
 #ifdef XP_UNIX
   if (S_ISLNK(ss.st_mode)) {
     return ensure_copy_symlink(path, dest);
   }
 #endif
 
   AutoFile infile = ensure_open(path, NS_T("rb"), ss.st_mode);
   if (!infile) {
-    LOG(("ensure_copy: failed to open the file for reading: " LOG_S ", err: %d\n",
-          path, errno));
+    LOG(("ensure_copy: failed to open the file for reading: " LOG_S ", err: %d",
+         path, errno));
     return READ_ERROR;
   }
   AutoFile outfile = ensure_open(dest, NS_T("wb"), ss.st_mode);
   if (!outfile) {
-    LOG(("ensure_copy: failed to open the file for writing: " LOG_S ", err: %d\n",
-          dest, errno));
+    LOG(("ensure_copy: failed to open the file for writing: " LOG_S ", err: %d",
+         dest, errno));
     return WRITE_ERROR;
   }
 
   void* buffer = malloc(ss.st_size);
   if (!buffer)
     return UPDATER_MEM_ERROR;
 
   size_t left = ss.st_size;
   while (left) {
     size_t read = fread(buffer, 1, left, infile);
     if (ferror(infile.get())) {
-      LOG(("ensure_copy: failed to read the file: " LOG_S ", err: %d\n",
+      LOG(("ensure_copy: failed to read the file: " LOG_S ", err: %d",
            path, errno));
       free(buffer);
       return READ_ERROR;
     }
 
     left -= read;
     size_t written = 0;
 
     while (written < read) {
       size_t chunkWritten = fwrite(buffer, 1, read - written, outfile);
       if (chunkWritten <= 0) {
-        LOG(("ensure_copy: failed to write the file: " LOG_S ", err: %d\n",
+        LOG(("ensure_copy: failed to write the file: " LOG_S ", err: %d",
              dest, errno));
         free(buffer);
         return WRITE_ERROR;
       }
 
       written += chunkWritten;
     }
   }
@@ -709,45 +709,45 @@ struct copy_recursive_skiplist {
 // The path names in the skiplist will be skipped and will not be copied.
 template <unsigned N>
 static int ensure_copy_recursive(const NS_tchar *path, const NS_tchar *dest,
                                  copy_recursive_skiplist<N>& skiplist)
 {
   struct stat sInfo;
   int rv = NS_tlstat(path, &sInfo);
   if (rv) {
-    LOG(("ensure_copy_recursive: path doesn't exist: " LOG_S ", rv: %d, err: %d\n",
-          path, rv, errno));
+    LOG(("ensure_copy_recursive: path doesn't exist: " LOG_S ", rv: %d, err: %d",
+         path, rv, errno));
     return READ_ERROR;
   }
 
 #ifdef XP_UNIX
   if (S_ISLNK(sInfo.st_mode)) {
     return ensure_copy_symlink(path, dest);
   }
 #endif
 
   if (!S_ISDIR(sInfo.st_mode)) {
     return ensure_copy(path, dest);
   }
 
   rv = NS_tmkdir(dest, sInfo.st_mode);
   if (rv < 0 && errno != EEXIST) {
-    LOG(("ensure_copy_recursive: could not create destination directory: " LOG_S ", rv: %d, err: %d\n",
+    LOG(("ensure_copy_recursive: could not create destination directory: " LOG_S ", rv: %d, err: %d",
          path, rv, errno));
     return WRITE_ERROR;
   }
 
   NS_tDIR *dir;
   NS_tdirent *entry;
 
   dir = NS_topendir(path);
   if (!dir) {
-    LOG(("ensure_copy_recursive: path is not a directory: " LOG_S ", rv: %d, err: %d\n",
-          path, rv, errno));
+    LOG(("ensure_copy_recursive: path is not a directory: " LOG_S ", rv: %d, err: %d",
+         path, rv, errno));
     return READ_ERROR;
   }
 
   while ((entry = NS_treaddir(dir)) != 0) {
     if (NS_tstrcmp(entry->d_name, NS_T(".")) &&
         NS_tstrcmp(entry->d_name, NS_T(".."))) {
       NS_tchar childPath[MAXPATHLEN];
       NS_tsnprintf(childPath, sizeof(childPath)/sizeof(childPath[0]),
@@ -776,41 +776,41 @@ static int rename_file(const NS_tchar *s
   int rv = ensure_parent_dir(dpath);
   if (rv)
     return rv;
 
   struct stat spathInfo;
   rv = NS_tstat(spath, &spathInfo);
   if (rv) {
     LOG(("rename_file: failed to read file status info: " LOG_S ", " \
-         "err: %d\n", spath, errno));
+         "err: %d", spath, errno));
     return READ_ERROR;
   }
 
   if (!S_ISREG(spathInfo.st_mode)) {
     if (allowDirs && !S_ISDIR(spathInfo.st_mode)) {
-      LOG(("rename_file: path present, but not a file: " LOG_S ", err: %d\n",
+      LOG(("rename_file: path present, but not a file: " LOG_S ", err: %d",
            spath, errno));
       return UNEXPECTED_FILE_OPERATION_ERROR;
     } else {
-      LOG(("rename_file: proceeding to rename the directory\n"));
+      LOG(("rename_file: proceeding to rename the directory"));
     }
   }
 
   if (!NS_taccess(dpath, F_OK)) {
     if (ensure_remove(dpath)) {
       LOG(("rename_file: destination file exists and could not be " \
-           "removed: " LOG_S "\n", dpath));
+           "removed: " LOG_S, dpath));
       return WRITE_ERROR;
     }
   }
 
   if (NS_trename(spath, dpath) != 0) {
     LOG(("rename_file: failed to rename file - src: " LOG_S ", " \
-         "dst:" LOG_S ", err: %d\n", spath, dpath, errno));
+         "dst:" LOG_S ", err: %d", spath, dpath, errno));
     return WRITE_ERROR;
   }
 
   return OK;
 }
 
 //-----------------------------------------------------------------------------
 
@@ -828,17 +828,17 @@ static int backup_create(const NS_tchar 
 // to the original file.
 static int backup_restore(const NS_tchar *path)
 {
   NS_tchar backup[MAXPATHLEN];
   NS_tsnprintf(backup, sizeof(backup)/sizeof(backup[0]),
                NS_T("%s") BACKUP_EXT, path);
 
   if (NS_taccess(backup, F_OK)) {
-    LOG(("backup_restore: backup file doesn't exist: " LOG_S "\n", backup));
+    LOG(("backup_restore: backup file doesn't exist: " LOG_S, backup));
     return OK;
   }
 
   return rename_file(backup, path);
 }
 
 // Discard the backup of the specified file that was created by renaming it.
 static int backup_discard(const NS_tchar *path)
@@ -850,35 +850,35 @@ static int backup_discard(const NS_tchar
   // Nothing to discard
   if (NS_taccess(backup, F_OK)) {
     return OK;
   }
 
   int rv = ensure_remove(backup);
 #if defined(XP_WIN)
   if (rv && !sBackgroundUpdate && !sReplaceRequest) {
-    LOG(("backup_discard: unable to remove: " LOG_S "\n", backup));
+    LOG(("backup_discard: unable to remove: " LOG_S, backup));
     NS_tchar path[MAXPATHLEN];
     GetTempFileNameW(DELETE_DIR, L"moz", 0, path);
     if (rename_file(backup, path)) {
-      LOG(("backup_discard: failed to rename file:" LOG_S ", dst:" LOG_S "\n",
+      LOG(("backup_discard: failed to rename file:" LOG_S ", dst:" LOG_S,
            backup, path));
       return WRITE_ERROR;
     }
     // The MoveFileEx call to remove the file on OS reboot will fail if the
     // process doesn't have write access to the HKEY_LOCAL_MACHINE registry key
     // but this is ok since the installer / uninstaller will delete the
     // directory containing the file along with its contents after an update is
     // applied, on reinstall, and on uninstall.
     if (MoveFileEx(path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT)) {
       LOG(("backup_discard: file renamed and will be removed on OS " \
-           "reboot: " LOG_S "\n", path));
+           "reboot: " LOG_S, path));
     } else {
       LOG(("backup_discard: failed to schedule OS reboot removal of " \
-           "file: " LOG_S "\n", path));
+           "file: " LOG_S, path));
     }
   }
 #else
   if (rv)
     return WRITE_ERROR;
 #endif
 
   return OK;
@@ -958,83 +958,83 @@ RemoveFile::Prepare()
   // Skip the file if it already doesn't exist.
   int rv = NS_taccess(mFile, F_OK);
   if (rv) {
     mSkip = 1;
     mProgressCost = 0;
     return OK;
   }
 
-  LOG(("PREPARE REMOVEFILE " LOG_S "\n", mFile));
+  LOG(("PREPARE REMOVEFILE " LOG_S, mFile));
 
   // Make sure that we're actually a file...
   struct stat fileInfo;
   rv = NS_tstat(mFile, &fileInfo);
   if (rv) {
-    LOG(("failed to read file status info: " LOG_S ", err: %d\n", mFile,
+    LOG(("failed to read file status info: " LOG_S ", err: %d", mFile,
          errno));
     return READ_ERROR;
   }
 
   if (!S_ISREG(fileInfo.st_mode)) {
-    LOG(("path present, but not a file: " LOG_S "\n", mFile));
+    LOG(("path present, but not a file: " LOG_S, mFile));
     return UNEXPECTED_FILE_OPERATION_ERROR;
   }
 
   NS_tchar *slash = (NS_tchar *) NS_tstrrchr(mFile, NS_T('/'));
   if (slash) {
     *slash = NS_T('\0');
     rv = NS_taccess(mFile, W_OK);
     *slash = NS_T('/');
   } else {
     rv = NS_taccess(NS_T("."), W_OK);
   }
 
   if (rv) {
-    LOG(("access failed: %d\n", errno));
+    LOG(("access failed: %d", errno));
     return WRITE_ERROR;
   }
 
   return OK;
 }
 
 int
 RemoveFile::Execute()
 {
   if (mSkip)
     return OK;
 
-  LOG(("EXECUTE REMOVEFILE " LOG_S "\n", mFile));
+  LOG(("EXECUTE REMOVEFILE " LOG_S, mFile));
 
   // The file is checked for existence here and in Prepare since it might have
   // been removed by a separate instruction: bug 311099.
   int rv = NS_taccess(mFile, F_OK);
   if (rv) {
-    LOG(("file cannot be removed because it does not exist; skipping\n"));
+    LOG(("file cannot be removed because it does not exist; skipping"));
     mSkip = 1;
     return OK;
   }
 
   // Rename the old file. It will be removed in Finish.
   rv = backup_create(mFile);
   if (rv) {
-    LOG(("backup_create failed: %d\n", rv));
+    LOG(("backup_create failed: %d", rv));
     return rv;
   }
 
   return OK;
 }
 
 void
 RemoveFile::Finish(int status)
 {
   if (mSkip)
     return;
 
-  LOG(("FINISH REMOVEFILE " LOG_S "\n", mFile));
+  LOG(("FINISH REMOVEFILE " LOG_S, mFile));
 
   backup_finish(mFile, status);
 }
 
 class RemoveDir : public Action
 {
 public:
   RemoveDir() : mDir(NULL), mSkip(0) { }
@@ -1067,80 +1067,80 @@ RemoveDir::Prepare()
   // We expect the directory to exist if we are to remove it.
   int rv = NS_taccess(mDir, F_OK);
   if (rv) {
     mSkip = 1;
     mProgressCost = 0;
     return OK;
   }
 
-  LOG(("PREPARE REMOVEDIR " LOG_S "/\n", mDir));
+  LOG(("PREPARE REMOVEDIR " LOG_S "/", mDir));
 
   // Make sure that we're actually a dir.
   struct stat dirInfo;
   rv = NS_tstat(mDir, &dirInfo);
   if (rv) {
-    LOG(("failed to read directory status info: " LOG_S ", err: %d\n", mDir,
+    LOG(("failed to read directory status info: " LOG_S ", err: %d", mDir,
          errno));
     return READ_ERROR;
   }
 
   if (!S_ISDIR(dirInfo.st_mode)) {
-    LOG(("path present, but not a directory: " LOG_S "\n", mDir));
+    LOG(("path present, but not a directory: " LOG_S, mDir));
     return UNEXPECTED_FILE_OPERATION_ERROR;
   }
 
   rv = NS_taccess(mDir, W_OK);
   if (rv) {
-    LOG(("access failed: %d, %d\n", rv, errno));
+    LOG(("access failed: %d, %d", rv, errno));
     return WRITE_ERROR;
   }
 
   return OK;
 }
 
 int
 RemoveDir::Execute()
 {
   if (mSkip)
     return OK;
 
-  LOG(("EXECUTE REMOVEDIR " LOG_S "/\n", mDir));
+  LOG(("EXECUTE REMOVEDIR " LOG_S "/", mDir));
 
   // The directory is checked for existence at every step since it might have
   // been removed by a separate instruction: bug 311099.
   int rv = NS_taccess(mDir, F_OK);
   if (rv) {
-    LOG(("directory no longer exists; skipping\n"));
+    LOG(("directory no longer exists; skipping"));
     mSkip = 1;
   }
 
   return OK;
 }
 
 void
 RemoveDir::Finish(int status)
 {
   if (mSkip || status != OK)
     return;
 
-  LOG(("FINISH REMOVEDIR " LOG_S "/\n", mDir));
+  LOG(("FINISH REMOVEDIR " LOG_S "/", mDir));
 
   // The directory is checked for existence at every step since it might have
   // been removed by a separate instruction: bug 311099.
   int rv = NS_taccess(mDir, F_OK);
   if (rv) {
-    LOG(("directory no longer exists; skipping\n"));
+    LOG(("directory no longer exists; skipping"));
     return;
   }
 
 
   if (status == OK) {
     if (NS_trmdir(mDir)) {
-      LOG(("non-fatal error removing directory: " LOG_S "/, rv: %d, err: %d\n",
+      LOG(("non-fatal error removing directory: " LOG_S "/, rv: %d, err: %d",
            mDir, rv, errno));
     }
   }
 }
 
 class AddFile : public Action
 {
 public:
@@ -1168,25 +1168,25 @@ AddFile::Parse(NS_tchar *line)
     return PARSE_ERROR;
 
   return OK;
 }
 
 int
 AddFile::Prepare()
 {
-  LOG(("PREPARE ADD " LOG_S "\n", mFile));
+  LOG(("PREPARE ADD " LOG_S, mFile));
 
   return OK;
 }
 
 int
 AddFile::Execute()
 {
-  LOG(("EXECUTE ADD " LOG_S "\n", mFile));
+  LOG(("EXECUTE ADD " LOG_S, mFile));
 
   int rv;
 
   // First make sure that we can actually get rid of any existing file.
   rv = NS_taccess(mFile, F_OK);
   if (rv == 0) {
     rv = backup_create(mFile);
     if (rv)
@@ -1196,34 +1196,34 @@ AddFile::Execute()
     if (rv)
       return rv;
   }
 
 #ifdef XP_WIN
   char sourcefile[MAXPATHLEN];
   if (!WideCharToMultiByte(CP_UTF8, 0, mFile, -1, sourcefile, MAXPATHLEN,
                            NULL, NULL)) {
-    LOG(("error converting wchar to utf8: %d\n", GetLastError()));
+    LOG(("error converting wchar to utf8: %d", GetLastError()));
     return STRING_CONVERSION_ERROR;
   }
 
   rv = gArchiveReader.ExtractFile(sourcefile, mFile);
 #else
   rv = gArchiveReader.ExtractFile(mFile, mFile);
 #endif
   if (!rv) {
     mAdded = true;
   }
   return rv;
 }
 
 void
 AddFile::Finish(int status)
 {
-  LOG(("FINISH ADD " LOG_S "\n", mFile));
+  LOG(("FINISH ADD " LOG_S, mFile));
   // When there is an update failure and a file has been added it is removed
   // here since there might not be a backup to replace it.
   if (status && mAdded)
     NS_tremove(mFile);
   backup_finish(mFile, status);
 }
 
 class PatchFile : public Action
@@ -1265,52 +1265,52 @@ PatchFile::~PatchFile()
 
 int
 PatchFile::LoadSourceFile(FILE* ofile)
 {
   struct stat os;
   int rv = fstat(fileno((FILE *)ofile), &os);
   if (rv) {
     LOG(("LoadSourceFile: unable to stat destination file: " LOG_S ", " \
-         "err: %d\n", mFile, errno));
+         "err: %d", mFile, errno));
     return READ_ERROR;
   }
 
   if (uint32_t(os.st_size) != header.slen) {
-    LOG(("LoadSourceFile: destination file size %d does not match expected size %d\n",
+    LOG(("LoadSourceFile: destination file size %d does not match expected size %d",
          uint32_t(os.st_size), header.slen));
     return UNEXPECTED_FILE_OPERATION_ERROR;
   }
 
   buf = (unsigned char *) malloc(header.slen);
   if (!buf)
     return UPDATER_MEM_ERROR;
 
   size_t r = header.slen;
   unsigned char *rb = buf;
   while (r) {
     const size_t count = mmin(SSIZE_MAX, r);
     size_t c = fread(rb, 1, count, ofile);
     if (c != count) {
-      LOG(("LoadSourceFile: error reading destination file: " LOG_S "\n",
+      LOG(("LoadSourceFile: error reading destination file: " LOG_S,
            mFile));
       return READ_ERROR;
     }
 
     r -= c;
     rb += c;
   }
 
   // Verify that the contents of the source file correspond to what we expect.
 
   unsigned int crc = crc32(buf, header.slen);
 
   if (crc != header.scrc32) {
     LOG(("LoadSourceFile: destination file crc %d does not match expected " \
-         "crc %d\n", crc, header.scrc32));
+         "crc %d", crc, header.scrc32));
     return CRC_ERROR;
   }
 
   return OK;
 }
 
 int
 PatchFile::Parse(NS_tchar *line)
@@ -1332,17 +1332,17 @@ PatchFile::Parse(NS_tchar *line)
     return PARSE_ERROR;
 
   return OK;
 }
 
 int
 PatchFile::Prepare()
 {
-  LOG(("PREPARE PATCH " LOG_S "\n", mFile));
+  LOG(("PREPARE PATCH " LOG_S, mFile));
 
   // extract the patch to a temporary file
   mPatchIndex = sPatchIndex++;
 
   NS_tsnprintf(spath, sizeof(spath)/sizeof(spath[0]),
                NS_T("%s/%d.patch"), gSourcePath, mPatchIndex);
 
   NS_tremove(spath);
@@ -1350,32 +1350,32 @@ PatchFile::Prepare()
   FILE *fp = NS_tfopen(spath, NS_T("wb"));
   if (!fp)
     return WRITE_ERROR;
 
 #ifdef XP_WIN
   char sourcefile[MAXPATHLEN];
   if (!WideCharToMultiByte(CP_UTF8, 0, mPatchFile, -1, sourcefile, MAXPATHLEN,
                            NULL, NULL)) {
-    LOG(("error converting wchar to utf8: %d\n", GetLastError()));
+    LOG(("error converting wchar to utf8: %d", GetLastError()));
     return STRING_CONVERSION_ERROR;
   }
 
   int rv = gArchiveReader.ExtractFileToStream(sourcefile, fp);
 #else
   int rv = gArchiveReader.ExtractFileToStream(mPatchFile, fp);
 #endif
   fclose(fp);
   return rv;
 }
 
 int
 PatchFile::Execute()
 {
-  LOG(("EXECUTE PATCH " LOG_S "\n", mFile));
+  LOG(("EXECUTE PATCH " LOG_S, mFile));
 
   AutoFile pfile = NS_tfopen(spath, NS_T("rb"));
   if (pfile == NULL)
     return READ_ERROR;
 
   int rv = MBS_ReadHeader(pfile, &header);
   if (rv)
     return rv;
@@ -1389,34 +1389,34 @@ PatchFile::Execute()
   } else {
     origfile = NS_tfopen(mFile, NS_T("rb"));
   }
 #else
   origfile = NS_tfopen(mFile, NS_T("rb"));
 #endif
 
   if (!origfile) {
-    LOG(("unable to open destination file: " LOG_S ", err: %d\n", mFile,
+    LOG(("unable to open destination file: " LOG_S ", err: %d", mFile,
          errno));
     return READ_ERROR;
   }
 
   rv = LoadSourceFile(origfile);
   fclose(origfile);
   if (rv) {
-    LOG(("LoadSourceFile failed\n"));
+    LOG(("LoadSourceFile failed"));
     return rv;
   }
 
   // Rename the destination file if it exists before proceeding so it can be
   // used to restore the file to its original state if there is an error.
   struct stat ss;
   rv = NS_tstat(mFile, &ss);
   if (rv) {
-    LOG(("failed to read file status info: " LOG_S ", err: %d\n", mFile,
+    LOG(("failed to read file status info: " LOG_S ", err: %d", mFile,
          errno));
     return READ_ERROR;
   }
 
   rv = backup_create(mFile);
   if (rv)
     return rv;
 
@@ -1464,17 +1464,17 @@ PatchFile::Execute()
   if (rv != -1) {
     ftruncate(fileno((FILE *)ofile), header.dlen);
   }
 #else
   AutoFile ofile = ensure_open(mFile, NS_T("wb+"), ss.st_mode);
 #endif
 
   if (ofile == NULL) {
-    LOG(("unable to create new file: " LOG_S ", err: %d\n", mFile, errno));
+    LOG(("unable to create new file: " LOG_S ", err: %d", mFile, errno));
     return WRITE_ERROR;
   }
 
 #ifdef XP_WIN
   if (!shouldTruncate) {
     fseek(ofile, 0, SEEK_SET);
   }
 #endif
@@ -1491,17 +1491,17 @@ PatchFile::Execute()
   buf = NULL;
 
   return rv;
 }
 
 void
 PatchFile::Finish(int status)
 {
-  LOG(("FINISH PATCH " LOG_S "\n", mFile));
+  LOG(("FINISH PATCH " LOG_S, mFile));
 
   backup_finish(mFile, status);
 }
 
 class AddIfFile : public AddFile
 {
 public:
   AddIfFile() : mTestFile(NULL) { }
@@ -1639,17 +1639,17 @@ LaunchCallbackApp(const NS_tchar *workin
 {
   putenv(const_cast<char*>("NO_EM_RESTART="));
   putenv(const_cast<char*>("MOZ_LAUNCHED_CHILD=1"));
 
   // Run from the specified working directory (see bug 312360). This is not
   // necessary on Windows CE since the application that launches the updater
   // passes the working directory as an --environ: command line argument.
   if (NS_tchdir(workingDir) != 0) {
-    LOG(("Warning: chdir failed\n"));
+    LOG(("Warning: chdir failed"));
   }
 
 #if defined(USE_EXECV)
   execv(argv[0], argv);
 #elif defined(XP_MACOSX)
   LaunchChild(argc, argv);
 #elif defined(XP_WIN)
   // Do not allow the callback to run when running an update through the
@@ -1885,64 +1885,64 @@ ProcessReplaceRequest()
                installDir);
 
   // First try to remove the possibly existing temp directory, because if this
   // directory exists, we will fail to rename sourceDir.
   // No need to error check here because if this fails, we will fail in the
   // next step anyways.
   ensure_remove_recursive(tmpDir);
 
-  LOG(("Begin moving sourceDir (" LOG_S ") to tmpDir (" LOG_S ")\n",
+  LOG(("Begin moving sourceDir (" LOG_S ") to tmpDir (" LOG_S ")",
        sourceDir, tmpDir));
   int rv = rename_file(sourceDir, tmpDir, true);
 #ifdef XP_WIN
   // On Windows, if Firefox is launched using the shortcut, it will hold a handle
   // to its installation directory open, which might not get released in time.
   // Therefore we wait a little bit here to see if the handle is released.
   // If it's not released, we just fail to perform the replace request.
   const int max_retries = 10;
   int retries = 0;
   while (rv == WRITE_ERROR && (retries++ < max_retries)) {
     LOG(("PerformReplaceRequest: sourceDir rename attempt %d failed. " \
-         "File: " LOG_S ". Last error: %d, err: %d\n", retries,
+         "File: " LOG_S ". Last error: %d, err: %d", retries,
          sourceDir, GetLastError(), rv));
 
     Sleep(100);
 
     rv = rename_file(sourceDir, tmpDir, true);
   }
 #endif
   if (rv) {
-    LOG(("Moving sourceDir to tmpDir failed, err: %d\n", rv));
+    LOG(("Moving sourceDir to tmpDir failed, err: %d", rv));
     return rv;
   }
 
-  LOG(("Begin moving newDir (" LOG_S ") to sourceDir (" LOG_S ")\n",
+  LOG(("Begin moving newDir (" LOG_S ") to sourceDir (" LOG_S ")",
        newDir, sourceDir));
   rv = rename_file(newDir, sourceDir, true);
   if (rv) {
-    LOG(("Moving newDir to sourceDir failed, err: %d\n", rv));
-    LOG(("Now, try to move tmpDir back to sourceDir\n"));
+    LOG(("Moving newDir to sourceDir failed, err: %d", rv));
+    LOG(("Now, try to move tmpDir back to sourceDir"));
     ensure_remove_recursive(sourceDir);
     int rv2 = rename_file(tmpDir, sourceDir, true);
     if (rv2) {
-      LOG(("Moving tmpDir back to sourceDir failed, err: %d\n", rv2));
+      LOG(("Moving tmpDir back to sourceDir failed, err: %d", rv2));
     }
     return rv;
   }
 
-  LOG(("Now, remove the tmpDir\n"));
+  LOG(("Now, remove the tmpDir"));
   rv = ensure_remove_recursive(tmpDir);
   if (rv) {
-    LOG(("Removing tmpDir failed, err: %d\n", rv));
+    LOG(("Removing tmpDir failed, err: %d", rv));
 #ifdef XP_WIN
     if (MoveFileExW(tmpDir, NULL, MOVEFILE_DELAY_UNTIL_REBOOT)) {
-      LOG(("tmpDir will be removed on OS reboot: " LOG_S "\n", tmpDir));
+      LOG(("tmpDir will be removed on OS reboot: " LOG_S, tmpDir));
     } else {
-      LOG(("Failed to schedule OS reboot removal of directory: " LOG_S "\n",
+      LOG(("Failed to schedule OS reboot removal of directory: " LOG_S,
            tmpDir));
     }
 #endif
   }
 
 #ifdef XP_MACOSX
   // On OS X, we need to copy anything else left over inside the Updated.app
   // directory, and then we need to get rid of it as it's no longer going to
@@ -1960,79 +1960,79 @@ ProcessReplaceRequest()
         NS_tsnprintf(childSrcPath, sizeof(childSrcPath)/sizeof(childSrcPath[0]),
                      NS_T("%s/%s"), updatedAppDir, entry->d_name);
         NS_tchar childDstPath[MAXPATHLEN];
         NS_tsnprintf(childDstPath, sizeof(childDstPath)/sizeof(childDstPath[0]),
                      NS_T("%s/%s"), installDir, entry->d_name);
         ensure_remove_recursive(childDstPath);
         rv = rename_file(childSrcPath, childDstPath, true);
         if (rv) {
-          LOG(("Moving " LOG_S " to " LOG_S " failed, err: %d\n",
+          LOG(("Moving " LOG_S " to " LOG_S " failed, err: %d",
                childSrcPath, childDstPath, errno));
         }
       }
     }
 
     NS_tclosedir(dir);
   } else {
-    LOG(("Updated.app dir can't be found: " LOG_S ", err: %d\n",
+    LOG(("Updated.app dir can't be found: " LOG_S ", err: %d",
          updatedAppDir, errno));
   }
   ensure_remove_recursive(updatedAppDir);
 
-  LOG(("Moving the precomplete file\n"));
+  LOG(("Moving the precomplete file"));
 
   // We also need to move the precomplete file too.
   NS_tchar precompleteSource[MAXPATHLEN];
   NS_tsnprintf(precompleteSource, sizeof(precompleteSource)/sizeof(precompleteSource[0]),
                NS_T("%s/precomplete"), installDir);
 
   NS_tchar precompleteTmp[MAXPATHLEN];
   NS_tsnprintf(precompleteTmp, sizeof(precompleteTmp)/sizeof(precompleteTmp[0]),
                NS_T("%s/precomplete.bak"), installDir);
 
   NS_tchar precompleteNew[MAXPATHLEN];
   NS_tsnprintf(precompleteNew, sizeof(precompleteNew)/sizeof(precompleteNew[0]),
                NS_T("%s/Updated.app/precomplete"), installDir);
 
   ensure_remove(precompleteTmp);
-  LOG(("Begin moving precompleteSrc to precompleteTmp\n"));
+  LOG(("Begin moving precompleteSrc to precompleteTmp"));
   rv = rename_file(precompleteSource, precompleteTmp);
-  LOG(("Moved precompleteSrc to precompleteTmp, err: %d\n", rv));
-  LOG(("Begin moving precompleteNew to precompleteSrc\n"));
+  LOG(("Moved precompleteSrc to precompleteTmp, err: %d", rv));
+  LOG(("Begin moving precompleteNew to precompleteSrc"));
   int rv2 = rename_file(precompleteNew, precompleteSource);
-  LOG(("Moved precompleteNew to precompleteSrc, err: %d\n", rv2));
+  LOG(("Moved precompleteNew to precompleteSrc, err: %d", rv2));
 
   // If new could not be moved to source, we only want to restore tmp to source
   // if the first step succeeded.  Note that it is possible for the first
   // rename to have failed as well, for example if the tmpFile exists and we
   // race between the ensure_remove call and the first rename call, but there
   // isn't too much that we can do about that, unfortunately.
   if (!rv && rv2) {
-    LOG(("Begin trying to recover precompleteSrc\n"));
+    LOG(("Begin trying to recover precompleteSrc"));
     rv = rename_file(precompleteTmp, precompleteSource);
-    LOG(("Moved precompleteTmp to precompleteSrc, err: %d\n", rv));
+    LOG(("Moved precompleteTmp to precompleteSrc, err: %d", rv));
   }
 
-  LOG(("Finished moving the precomplete file\n"));
+  LOG(("Finished moving the precomplete file"));
 #endif
 
   gSucceeded = true;
 
   return 0;
 }
 
 #ifdef XP_WIN
 static void 
 WaitForServiceFinishThread(void *param)
 {
   // We wait at most 10 minutes, we already waited 5 seconds previously
   // before deciding to show this UI.
   WaitForServiceStop(SVC_NAME, 595);
-  LOG(("calling QuitProgressUI\n"));
+  LOG(("calling QuitProgressUI"));
   QuitProgressUI();
 }
 #endif
 
 #ifdef MOZ_VERIFY_MAR_SIGNATURE
 /**
  * This function reads in the ACCEPTED_MAR_CHANNEL_IDS from update-settings.ini
  *
@@ -2156,43 +2156,43 @@ UpdateThreadFunc(void *param)
       char processUpdates[] = "MOZ_PROCESS_UPDATES=";
       putenv(processUpdates); // We need to use -process-updates again in the tests
       reportRealResults = false; // pretend success
     }
   }
 
   if (reportRealResults) {
     if (rv) {
-      LOG(("failed: %d\n", rv));
+      LOG(("failed: %d", rv));
     }
     else {
 #ifdef XP_MACOSX
       // If the update was successful we need to update the timestamp
       // on the top-level Mac OS X bundle directory so that Mac OS X's
       // Launch Services picks up any major changes. Here we assume that
       // the current working directory is the top-level bundle directory.
       char* cwd = getcwd(NULL, 0);
       if (cwd) {
         if (utimes(cwd, NULL) != 0) {
-          LOG(("Couldn't set access/modification time on application bundle.\n"));
+          LOG(("Couldn't set access/modification time on application bundle."));
         }
         free(cwd);
       }
       else {
         LOG(("Couldn't get current working directory for setting "
-             "access/modification time on application bundle.\n"));
+             "access/modification time on application bundle."));
       }
 #endif
 
-      LOG(("succeeded\n"));
+      LOG(("succeeded"));
     }
     WriteStatusFile(rv);
   }
 
-  LOG(("calling QuitProgressUI\n"));
+  LOG(("calling QuitProgressUI"));
   QuitProgressUI();
 }
 
 int NS_main(int argc, NS_tchar **argv)
 {
   InitProgressUI(&argc, &argv);
 
   // To process an update the updater command line must at a minimum have the
@@ -2311,24 +2311,24 @@ int NS_main(int argc, NS_tchar **argv)
 #endif
 
     LogInitAppend(logDir, NS_T("last-update.log"), NS_T("update.log"));
   } else {
     LogInit(gSourcePath, NS_T("update.log"));
   }
 
   if (!WriteStatusFile("applying")) {
-    LOG(("failed setting status to 'applying'\n"));
+    LOG(("failed setting status to 'applying'"));
     return 1;
   }
 
   if (sBackgroundUpdate) {
-    LOG(("Performing a background update\n"));
+    LOG(("Performing a background update"));
   } else if (sReplaceRequest) {
-    LOG(("Performing a replace request\n"));
+    LOG(("Performing a replace request"));
   }
 
 #ifdef XP_WIN
   int possibleWriteError; // Variable holding one of the errors 46-48
   if (pid > 0) {
     HANDLE parent = OpenProcess(SYNCHRONIZE, false, (DWORD) pid);
     // May return NULL if the parent process has already gone away.
     // Otherwise, wait for the parent process to exit before starting the
@@ -2416,17 +2416,17 @@ int NS_main(int argc, NS_tchar **argv)
         NS_tremove(updateLockFilePath) != 0) {
       // Try to fall back to the old way of doing updates if a background
       // update fails.
       if (sBackgroundUpdate || sReplaceRequest) {
         // Note that this could fail, but if it does, there isn't too much we
         // can do in order to recover anyways.
         WriteStatusFile("pending");
       }
-      LOG(("Update already in progress! Exiting\n"));
+      LOG(("Update already in progress! Exiting"));
       return 1;
     }
 
     updateLockFileHandle = CreateFileW(updateLockFilePath,
                                        GENERIC_READ | GENERIC_WRITE,
                                        0,
                                        NULL,
                                        OPEN_ALWAYS,
@@ -2467,17 +2467,17 @@ int NS_main(int argc, NS_tchar **argv)
                                        GENERIC_READ | GENERIC_WRITE,
                                        0,
                                        NULL,
                                        OPEN_ALWAYS,
                                        FILE_FLAG_DELETE_ON_CLOSE,
                                        NULL);
 
       if (elevatedFileHandle == INVALID_HANDLE_VALUE) {
-        LOG(("Unable to create elevated lock file! Exiting\n"));
+        LOG(("Unable to create elevated lock file! Exiting"));
         return 1;
       }
 
       PRUnichar *cmdLine = MakeCommandLine(argc - 1, argv + 1);
       if (!cmdLine) {
         CloseHandle(elevatedFileHandle);
         return 1;
       }
@@ -2712,18 +2712,18 @@ int NS_main(int argc, NS_tchar **argv)
         }
       } else {
         // Failed to create the directory, bail out
         return 1;
       }
     }
   }
 
-  LOG(("SOURCE DIRECTORY " LOG_S "\n", gSourcePath));
-  LOG(("DESTINATION DIRECTORY " LOG_S "\n", gDestinationPath));
+  LOG(("SOURCE DIRECTORY " LOG_S, gSourcePath));
+  LOG(("DESTINATION DIRECTORY " LOG_S, gDestinationPath));
 
 #ifdef XP_WIN
   // For replace requests, we don't need to do any real updates, so this is not
   // necessary.
   if (!sReplaceRequest) {
     // Allocate enough space for the length of the path an optional additional
     // trailing slash and null termination.
     NS_tchar *destpath = (NS_tchar *) malloc((NS_tstrlen(gDestinationPath) + 2) * sizeof(NS_tchar));
@@ -2742,17 +2742,17 @@ int NS_main(int argc, NS_tchar **argv)
     c++;
 
     gDestPath = destpath;
   }
 
   NS_tchar applyDirLongPath[MAXPATHLEN];
   if (!GetLongPathNameW(gDestinationPath, applyDirLongPath,
                         sizeof(applyDirLongPath)/sizeof(applyDirLongPath[0]))) {
-    LOG(("NS_main: unable to find apply to dir: " LOG_S "\n", gDestinationPath));
+    LOG(("NS_main: unable to find apply to dir: " LOG_S, gDestinationPath));
     LogFinish();
     WriteStatusFile(WRITE_ERROR);
     EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 1);
     if (argc > callbackIndex) {
       LaunchCallbackApp(argv[4], argc - callbackIndex,
                         argv + callbackIndex, sUsingService);
     }
     return 1;
@@ -2785,17 +2785,17 @@ int NS_main(int argc, NS_tchar **argv)
       if (!GetInstallationDir(installDir))
         return 1;
       size_t callbackPrefixLength = PathCommonPrefixW(argv[callbackIndex], installDir, NULL);
       NS_tstrcpy(p, argv[callbackIndex] + max(callbackPrefixLength, commonPrefixLength));
       targetPath = buffer;
     }
     if (!GetLongPathNameW(targetPath, callbackLongPath,
                           sizeof(callbackLongPath)/sizeof(callbackLongPath[0]))) {
-      LOG(("NS_main: unable to find callback file: " LOG_S "\n", targetPath));
+      LOG(("NS_main: unable to find callback file: " LOG_S, targetPath));
       LogFinish();
       WriteStatusFile(WRITE_ERROR);
       EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 1);
       if (argc > callbackIndex) {
         LaunchCallbackApp(argv[4], 
                           argc - callbackIndex, 
                           argv + callbackIndex, 
                           sUsingService);
@@ -2849,27 +2849,27 @@ int NS_main(int argc, NS_tchar **argv)
                                    // allow delete, rename, and write
                                    FILE_SHARE_DELETE | FILE_SHARE_WRITE,
                                    NULL, OPEN_EXISTING, 0, NULL);
         if (callbackFile != INVALID_HANDLE_VALUE)
           break;
 
         lastWriteError = GetLastError();
         LOG(("NS_main: callback app open attempt %d failed. " \
-             "File: " LOG_S ". Last error: %d\n", retries,
+             "File: " LOG_S ". Last error: %d", retries,
              targetPath, lastWriteError));
 
         Sleep(100);
       } while (++retries <= max_retries);
 
       // CreateFileW will fail if the callback executable is already in use. Since
       // it isn't possible to update write the status file and return.
       if (callbackFile == INVALID_HANDLE_VALUE) {
         LOG(("NS_main: file in use - failed to exclusively open executable " \
-             "file: " LOG_S "\n", argv[callbackIndex]));
+             "file: " LOG_S, argv[callbackIndex]));
         LogFinish();
         if (ERROR_ACCESS_DENIED == lastWriteError) {
           WriteStatusFile(WRITE_ERROR_ACCESS_DENIED);
         } else if (ERROR_SHARING_VIOLATION == lastWriteError) {
           WriteStatusFile(possibleWriteError);
         } else {
           WriteStatusFile(WRITE_ERROR_CALLBACK_APP);
         }
@@ -2909,33 +2909,33 @@ int NS_main(int argc, NS_tchar **argv)
 #ifdef XP_WIN
   if (argc > callbackIndex && !sReplaceRequest) {
     CloseHandle(callbackFile);
     // Remove the copy of the callback executable.
     NS_tremove(gCallbackBackupPath);
   }
 
   if (!sBackgroundUpdate && !sReplaceRequest && _wrmdir(DELETE_DIR)) {
-    LOG(("NS_main: unable to remove directory: " LOG_S ", err: %d\n",
+    LOG(("NS_main: unable to remove directory: " LOG_S ", err: %d",
          DELETE_DIR, errno));
     // The directory probably couldn't be removed due to it containing files
     // that are in use and will be removed on OS reboot. The call to remove the
     // directory on OS reboot is done after the calls to remove the files so the
     // files are removed first on OS reboot since the directory must be empty
     // for the directory removal to be successful. The MoveFileEx call to remove
     // the directory on OS reboot will fail if the process doesn't have write
     // access to the HKEY_LOCAL_MACHINE registry key but this is ok since the
     // installer / uninstaller will delete the directory along with its contents
     // after an update is applied, on reinstall, and on uninstall.
     if (MoveFileEx(DELETE_DIR, NULL, MOVEFILE_DELAY_UNTIL_REBOOT)) {
-      LOG(("NS_main: directory will be removed on OS reboot: " LOG_S "\n",
+      LOG(("NS_main: directory will be removed on OS reboot: " LOG_S,
            DELETE_DIR));
     } else {
       LOG(("NS_main: failed to schedule OS reboot removal of " \
-           "directory: " LOG_S "\n", DELETE_DIR));
+           "directory: " LOG_S, DELETE_DIR));
     }
   }
 #endif /* XP_WIN */
 
 #if defined(MOZ_WIDGET_GONK)
   } // end the extra level of scope for the GonkAutoMounter
 #endif
 
@@ -2950,17 +2950,17 @@ int NS_main(int argc, NS_tchar **argv)
       // because it's possible we are updating with updater.exe without the 
       // service if the service failed to apply the update. We want to update
       // the service to a newer version in that case. If we are not running
       // through the service, then MOZ_USING_SERVICE will not exist.
       if (!sUsingService) {
         NS_tchar installDir[MAXPATHLEN];
         if (GetInstallationDir(installDir)) {
           if (!LaunchWinPostProcess(installDir, gSourcePath, false, NULL)) {
-            LOG(("NS_main: The post update process could not be launched.\n"));
+            LOG(("NS_main: The post update process could not be launched."));
           }
 
           StartServiceUpdate(installDir);
         }
       }
     }
     EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 0);
 #endif /* XP_WIN */
@@ -3020,17 +3020,17 @@ ActionList::Append(Action *action)
 
 int
 ActionList::Prepare()
 {
   // If the action list is empty then we should fail in order to signal that
   // something has gone wrong. Otherwise we report success when nothing is
   // actually done. See bug 327140.
   if (mCount == 0) {
-    LOG(("empty action list\n"));
+    LOG(("empty action list"));
     return UNEXPECTED_MAR_ERROR;
   }
 
   Action *a = mFirst;
   int i = 0;
   while (a) {
     int rv = a->Prepare();
     if (rv)
@@ -3054,17 +3054,17 @@ ActionList::Execute()
     maxProgress += a->mProgressCost;
     a = a->mNext;
   }
 
   a = mFirst;
   while (a) {
     int rv = a->Execute();
     if (rv) {
-      LOG(("### execution failed\n"));
+      LOG(("### execution failed"));
       return rv;
     }
 
     currentProgress += a->mProgressCost;
     float percent = float(currentProgress) / float(maxProgress);
     UpdateProgressUI(PROGRESS_PREPARE_SIZE +
                      PROGRESS_EXECUTE_SIZE * percent);
 
@@ -3119,29 +3119,29 @@ int add_dir_entries(const NS_tchar *dirp
       NS_tsnprintf(foundpath, sizeof(foundpath)/sizeof(foundpath[0]),
                    NS_T("%s%s"), dirpath, finddata.cFileName);
       if (finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
         NS_tsnprintf(foundpath, sizeof(foundpath)/sizeof(foundpath[0]),
                      NS_T("%s/"), foundpath);
         // Recurse into the directory.
         rv = add_dir_entries(foundpath, list);
         if (rv) {
-          LOG(("add_dir_entries error: " LOG_S ", err: %d\n", foundpath, rv));
+          LOG(("add_dir_entries error: " LOG_S ", err: %d", foundpath, rv));
           return rv;
         }
       } else {
         // Add the file to be removed to the ActionList.
         NS_tchar *quotedpath = get_quoted_path(foundpath);
         if (!quotedpath)
           return PARSE_ERROR;
 
         Action *action = new RemoveFile();
         rv = action->Parse(quotedpath);
         if (rv) {
-          LOG(("add_dir_entries Parse error on recurse: " LOG_S ", err: %d\n", quotedpath, rv));
+          LOG(("add_dir_entries Parse error on recurse: " LOG_S ", err: %d", quotedpath, rv));
           return rv;
         }
 
         list->Append(action);
       }
     } while (FindNextFileW(hFindFile, &finddata) != 0);
 
     FindClose(hFindFile);
@@ -3149,17 +3149,17 @@ int add_dir_entries(const NS_tchar *dirp
       // Add the directory to be removed to the ActionList.
       NS_tchar *quotedpath = get_quoted_path(dirpath);
       if (!quotedpath)
         return PARSE_ERROR;
 
       Action *action = new RemoveDir();
       rv = action->Parse(quotedpath);
       if (rv)
-        LOG(("add_dir_entries Parse error on close: " LOG_S ", err: %d\n", quotedpath, rv));
+        LOG(("add_dir_entries Parse error on close: " LOG_S ", err: %d", quotedpath, rv));
       else
         list->Append(action);
     }
   }
 
   return rv;
 }
 
@@ -3179,17 +3179,17 @@ int add_dir_entries(const NS_tchar *dirp
   NS_tsnprintf(searchpath, sizeof(searchpath)/sizeof(searchpath[0]), NS_T("%s"),
                dirpath);
   // Remove the trailing slash so the paths don't contain double slashes. The
   // existence of the slash has already been checked in DoUpdate.
   searchpath[NS_tstrlen(searchpath) - 1] = NS_T('\0');
 
   DIR* dir = opendir(searchpath);
   if (!dir) {
-    LOG(("add_dir_entries error on opendir: " LOG_S ", err: %d\n", searchpath,
+    LOG(("add_dir_entries error on opendir: " LOG_S ", err: %d", searchpath,
          errno));
     return UNEXPECTED_FILE_OPERATION_ERROR;
   }
 
   while (readdir_r(dir, (dirent *)&ent_buf, &ent) == 0 && ent) {
     if ((strcmp(ent->d_name, ".") == 0) ||
         (strcmp(ent->d_name, "..") == 0))
       continue;
@@ -3203,32 +3203,32 @@ int add_dir_entries(const NS_tchar *dirp
       return UNEXPECTED_FILE_OPERATION_ERROR;
     }
     if (S_ISDIR(st_buf.st_mode)) {
       NS_tsnprintf(foundpath, sizeof(foundpath)/sizeof(foundpath[0]),
                    NS_T("%s/"), foundpath);
       // Recurse into the directory.
       rv = add_dir_entries(foundpath, list);
       if (rv) {
-        LOG(("add_dir_entries error: " LOG_S ", err: %d\n", foundpath, rv));
+        LOG(("add_dir_entries error: " LOG_S ", err: %d", foundpath, rv));
         closedir(dir);
         return rv;
       }
     } else {
       // Add the file to be removed to the ActionList.
       NS_tchar *quotedpath = get_quoted_path(foundpath);
       if (!quotedpath) {
         closedir(dir);
         return PARSE_ERROR;
       }
 
       Action *action = new RemoveFile();
       rv = action->Parse(quotedpath);
       if (rv) {
-        LOG(("add_dir_entries Parse error on recurse: " LOG_S ", err: %d\n",
+        LOG(("add_dir_entries Parse error on recurse: " LOG_S ", err: %d",
              quotedpath, rv));
         closedir(dir);
         return rv;
       }
 
       list->Append(action);
     }
   }
@@ -3237,17 +3237,17 @@ int add_dir_entries(const NS_tchar *dirp
   // Add the directory to be removed to the ActionList.
   NS_tchar *quotedpath = get_quoted_path(dirpath);
   if (!quotedpath)
     return PARSE_ERROR;
 
   Action *action = new RemoveDir();
   rv = action->Parse(quotedpath);
   if (rv) {
-    LOG(("add_dir_entries Parse error on close: " LOG_S ", err: %d\n",
+    LOG(("add_dir_entries Parse error on close: " LOG_S ", err: %d",
          quotedpath, rv));
   }
   else {
     list->Append(action);
   }
 
   return rv;
 }
@@ -3280,17 +3280,17 @@ int add_dir_entries(const NS_tchar *dirp
     NS_tchar *quotedpath;
     Action *action = NULL;
 
     switch (ftsdirEntry->fts_info) {
       // Filesystem objects that shouldn't be in the application's directories
       case FTS_SL:
       case FTS_SLNONE:
       case FTS_DEFAULT:
-        LOG(("add_dir_entries: found a non-standard file: " LOG_S "\n",
+        LOG(("add_dir_entries: found a non-standard file: " LOG_S,
              ftsdirEntry->fts_path));
         // Fall through and try to remove as a file
 
       // Files
       case FTS_F:
       case FTS_NSOK:
         // Add the file to be removed to the ActionList.
         NS_tsnprintf(foundpath, sizeof(foundpath)/sizeof(foundpath[0]),
@@ -3333,23 +3333,23 @@ int add_dir_entries(const NS_tchar *dirp
         if (ENOENT == ftsdirEntry->fts_errno) {
           rv = OK;
           break;
         }
         // Fall through
 
       case FTS_ERR:
         rv = UNEXPECTED_FILE_OPERATION_ERROR;
-        LOG(("add_dir_entries: fts_read() error: " LOG_S ", err: %d\n",
+        LOG(("add_dir_entries: fts_read() error: " LOG_S ", err: %d",
              ftsdirEntry->fts_path, ftsdirEntry->fts_errno));
         break;
 
       case FTS_DC:
         rv = UNEXPECTED_FILE_OPERATION_ERROR;
-        LOG(("add_dir_entries: fts_read() returned FT_DC: " LOG_S "\n",
+        LOG(("add_dir_entries: fts_read() returned FT_DC: " LOG_S,
              ftsdirEntry->fts_path));
         break;
 
       default:
         // FTS_D is ignored and FTS_DP is used instead (post-order).
         rv = OK;
         break;
     }
@@ -3364,38 +3364,38 @@ int add_dir_entries(const NS_tchar *dirp
 }
 #endif
 
 static NS_tchar*
 GetManifestContents(const NS_tchar *manifest)
 {
   AutoFile mfile = NS_tfopen(manifest, NS_T("rb"));
   if (mfile == NULL) {
-    LOG(("GetManifestContents: error opening manifest file: " LOG_S "\n", manifest));
+    LOG(("GetManifestContents: error opening manifest file: " LOG_S, manifest));
     return NULL;
   }
 
   struct stat ms;
   int rv = fstat(fileno((FILE *)mfile), &ms);
   if (rv) {
-    LOG(("GetManifestContents: error stating manifest file: " LOG_S "\n", manifest));
+    LOG(("GetManifestContents: error stating manifest file: " LOG_S, manifest));
     return NULL;
   }
 
   char *mbuf = (char *) malloc(ms.st_size + 1);
   if (!mbuf)
     return NULL;
 
   size_t r = ms.st_size;
   char *rb = mbuf;
   while (r) {
     const size_t count = mmin(SSIZE_MAX, r);
     size_t c = fread(rb, 1, count, mfile);
     if (c != count) {
-      LOG(("GetManifestContents: error reading manifest file: " LOG_S "\n", manifest));
+      LOG(("GetManifestContents: error reading manifest file: " LOG_S, manifest));
       return NULL;
     }
 
     r -= c;
     rb += c;
   }
   mbuf[ms.st_size] = '\0';
   rb = mbuf;
@@ -3404,17 +3404,17 @@ GetManifestContents(const NS_tchar *mani
   return rb;
 #else
   NS_tchar *wrb = (NS_tchar *) malloc((ms.st_size + 1) * sizeof(NS_tchar));
   if (!wrb)
     return NULL;
 
   if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, rb, -1, wrb,
                            ms.st_size + 1)) {
-    LOG(("GetManifestContents: error converting utf8 to utf16le: %d\n", GetLastError()));
+    LOG(("GetManifestContents: error converting utf8 to utf16le: %d", GetLastError()));
     free(mbuf);
     free(wrb);
     return NULL;
   }
   free(mbuf);
 
   return wrb;
 #endif
@@ -3424,46 +3424,46 @@ int AddPreCompleteActions(ActionList *li
 {
   if (sIsOSUpdate) {
     return OK;
   }
 
   NS_tchar *rb = GetManifestContents(NS_T("precomplete"));
   if (rb == NULL) {
     LOG(("AddPreCompleteActions: error getting contents of precomplete " \
-         "manifest\n"));
+         "manifest"));
     // Applications aren't required to have a precomplete manifest yet.
     return OK;
   }
 
   int rv;
   NS_tchar *line;
   while((line = mstrtok(kNL, &rb)) != 0) {
     // skip comments
     if (*line == NS_T('#'))
       continue;
 
     NS_tchar *token = mstrtok(kWhitespace, &line);
     if (!token) {
-      LOG(("AddPreCompleteActions: token not found in manifest\n"));
+      LOG(("AddPreCompleteActions: token not found in manifest"));
       return PARSE_ERROR;
     }
 
     Action *action = NULL;
     if (NS_tstrcmp(token, NS_T("remove")) == 0) { // rm file
       action = new RemoveFile();
     }
     else if (NS_tstrcmp(token, NS_T("remove-cc")) == 0) { // no longer supported
       continue;
     }
     else if (NS_tstrcmp(token, NS_T("rmdir")) == 0) { // rmdir if  empty
       action = new RemoveDir();
     }
     else {
-      LOG(("AddPreCompleteActions: unknown token: " LOG_S "\n", token));
+      LOG(("AddPreCompleteActions: unknown token: " LOG_S, token));
       return PARSE_ERROR;
     }
 
     if (!action)
       return BAD_ACTION_ERROR;
 
     rv = action->Parse(line);
     if (rv)
@@ -3481,46 +3481,46 @@ int DoUpdate()
   NS_tsnprintf(manifest, sizeof(manifest)/sizeof(manifest[0]),
                NS_T("%s/update.manifest"), gSourcePath);
 
   // extract the manifest
   int rv = gArchiveReader.ExtractFile("updatev2.manifest", manifest);
   if (rv) {
     rv = gArchiveReader.ExtractFile("update.manifest", manifest);
     if (rv) {
-      LOG(("DoUpdate: error extracting manifest file\n"));
+      LOG(("DoUpdate: error extracting manifest file"));
       return rv;
     }
   }
 
   NS_tchar *rb = GetManifestContents(manifest);
   if (rb == NULL) {
-    LOG(("DoUpdate: error opening manifest file: " LOG_S "\n", manifest));
+    LOG(("DoUpdate: error opening manifest file: " LOG_S, manifest));
     return READ_ERROR;
   }
 
 
   ActionList list;
   NS_tchar *line;
   bool isFirstAction = true;
 
   while((line = mstrtok(kNL, &rb)) != 0) {
     // skip comments
     if (*line == NS_T('#'))
       continue;
 
     NS_tchar *token = mstrtok(kWhitespace, &line);
     if (!token) {
-      LOG(("DoUpdate: token not found in manifest\n"));
+      LOG(("DoUpdate: token not found in manifest"));
       return PARSE_ERROR;
     }
 
     if (isFirstAction && NS_tstrcmp(token, NS_T("type")) == 0) {
       const NS_tchar *type = mstrtok(kQuote, &line);
-      LOG(("UPDATE TYPE " LOG_S "\n", type));
+      LOG(("UPDATE TYPE " LOG_S, type));
       if (NS_tstrcmp(type, NS_T("complete")) == 0) {
         rv = AddPreCompleteActions(&list);
         if (rv)
           return rv;
       }
       isFirstAction = false;
       continue;
     }
@@ -3559,17 +3559,17 @@ int DoUpdate()
     }
     else if (NS_tstrcmp(token, NS_T("patch-if")) == 0) { // Patch if exists
       action = new PatchIfFile();
     }
     else if (NS_tstrcmp(token, NS_T("add-cc")) == 0) { // no longer supported
       continue;
     }
     else {
-      LOG(("DoUpdate: unknown token: " LOG_S "\n", token));
+      LOG(("DoUpdate: unknown token: " LOG_S, token));
       return PARSE_ERROR;
     }
 
     if (!action)
       return BAD_ACTION_ERROR;
 
     rv = action->Parse(line);
     if (rv)