summaryrefslogtreecommitdiff
path: root/src/burn/engine/logging.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-08-03 15:42:40 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-08-04 10:03:57 -0500
commitc50e82c27b7f33b9024a04ec7ad7d4301bc7f7ca (patch)
tree1340ef3bf598ec362bf4dcf135e65343db3e7d14 /src/burn/engine/logging.cpp
parent94b8260fc5c1abc199f8d6145f3db4e2de490463 (diff)
downloadwix-c50e82c27b7f33b9024a04ec7ad7d4301bc7f7ca.tar.gz
wix-c50e82c27b7f33b9024a04ec7ad7d4301bc7f7ca.tar.bz2
wix-c50e82c27b7f33b9024a04ec7ad7d4301bc7f7ca.zip
Create separate log file for clean room.
Diffstat (limited to 'src/burn/engine/logging.cpp')
-rw-r--r--src/burn/engine/logging.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/burn/engine/logging.cpp b/src/burn/engine/logging.cpp
index 6b19cc8a..9aaf60ed 100644
--- a/src/burn/engine/logging.cpp
+++ b/src/burn/engine/logging.cpp
@@ -39,11 +39,12 @@ extern "C" HRESULT LoggingOpen(
39 HRESULT hr = S_OK; 39 HRESULT hr = S_OK;
40 LPWSTR sczLoggingBaseFolder = NULL; 40 LPWSTR sczLoggingBaseFolder = NULL;
41 LPWSTR sczPrefixFormatted = NULL; 41 LPWSTR sczPrefixFormatted = NULL;
42 LPCWSTR wzPostfix = BURN_MODE_UNTRUSTED == pInternalCommand->mode ? L".cleanroom" : NULL;
42 43
43 hr = InitializeLogging(pLog, pInternalCommand); 44 hr = InitializeLogging(pLog, pInternalCommand);
44 ExitOnFailure(hr, "Failed to initialize logging."); 45 ExitOnFailure(hr, "Failed to initialize logging.");
45 46
46 if (pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_VERBOSE || pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_EXTRADEBUG) 47 if ((pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_VERBOSE) || (pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_EXTRADEBUG))
47 { 48 {
48 if (pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_EXTRADEBUG) 49 if (pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_EXTRADEBUG)
49 { 50 {
@@ -54,9 +55,17 @@ extern "C" HRESULT LoggingOpen(
54 LogSetLevel(REPORT_VERBOSE, FALSE); 55 LogSetLevel(REPORT_VERBOSE, FALSE);
55 } 56 }
56 57
58 // In these modes, make sure a log will be created even if the bundle wasn't configured to create one.
57 if ((!pLog->sczPath || !*pLog->sczPath) && (!pLog->sczPrefix || !*pLog->sczPrefix)) 59 if ((!pLog->sczPath || !*pLog->sczPath) && (!pLog->sczPrefix || !*pLog->sczPrefix))
58 { 60 {
59 PathCreateTimeBasedTempFile(NULL, L"Setup", NULL, L"log", &pLog->sczPath, NULL); 61 hr = StrAllocString(&pLog->sczPrefix, L"Setup", 0);
62 ExitOnFailure(hr, "Failed to copy default log prefix.");
63
64 if (!pLog->sczExtension || !*pLog->sczExtension)
65 {
66 hr = StrAllocString(&pLog->sczExtension, L"log", 0);
67 ExitOnFailure(hr, "Failed to copy default log extension.");
68 }
60 } 69 }
61 } 70 }
62 71
@@ -134,7 +143,7 @@ extern "C" HRESULT LoggingOpen(
134 ExitOnFailure(hr, "Failed to get non-session specific TEMP folder."); 143 ExitOnFailure(hr, "Failed to get non-session specific TEMP folder.");
135 } 144 }
136 145
137 hr = LogOpen(sczLoggingBaseFolder, wzPrefix, NULL, pLog->sczExtension, FALSE, FALSE, &pLog->sczPath); 146 hr = LogOpen(sczLoggingBaseFolder, wzPrefix, wzPostfix, pLog->sczExtension, FALSE, FALSE, &pLog->sczPath);
138 if (FAILED(hr)) 147 if (FAILED(hr))
139 { 148 {
140 LogDisable(); 149 LogDisable();
@@ -760,7 +769,9 @@ static HRESULT InitializeLogging(
760 769
761 pLog->dwAttributes |= pInternalCommand->dwLoggingAttributes; 770 pLog->dwAttributes |= pInternalCommand->dwLoggingAttributes;
762 771
763 if (pInternalCommand->sczLogFile) 772 // The untrusted process needs a separate log file.
773 // TODO: Burn crashes if they do try to use the same log file.
774 if (pInternalCommand->sczLogFile && BURN_MODE_UNTRUSTED != pInternalCommand->mode)
764 { 775 {
765 hr = StrAllocString(&pLog->sczPath, pInternalCommand->sczLogFile, 0); 776 hr = StrAllocString(&pLog->sczPath, pInternalCommand->sczLogFile, 0);
766 ExitOnFailure(hr, "Failed to copy log file path from command line."); 777 ExitOnFailure(hr, "Failed to copy log file path from command line.");