Skip to content

Commit 9ba89c8

Browse files
committed
MAGECLOUD-2895: The var/log/install_upgrade.log is useless without dividers and timestamps
1 parent f543cef commit 9ba89c8

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/Process/Deploy/InstallUpdate/Install/Setup.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ public function execute()
112112
}
113113

114114
try {
115-
$this->shell->execute("echo 'Installation time: '$(date)");
115+
$installUpgradeLog = $this->fileList->getInstallUpgradeLog();
116+
117+
$this->shell->execute('echo \'Installation time: \'$(date) | tee -a ' . $installUpgradeLog);
116118
$this->shell->execute(sprintf(
117119
'/bin/bash -c "set -o pipefail; %s | tee -a %s"',
118120
escapeshellcmd($command),
119-
$this->fileList->getInstallUpgradeLog()
121+
$installUpgradeLog
120122
));
121123
} catch (ShellException $exception) {
122124
throw new ProcessException($exception->getMessage(), $exception->getCode(), $exception);

src/Process/Deploy/InstallUpdate/Update/Setup.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,15 @@ public function execute()
9393

9494
try {
9595
$verbosityLevel = $this->stageConfig->get(DeployInterface::VAR_VERBOSE_COMMANDS);
96+
$installUpgradeLog = $this->fileList->getInstallUpgradeLog();
9697

9798
$this->logger->info('Running setup upgrade.');
9899

99-
$this->shell->execute("echo 'Upgrading time: '$(date)");
100+
$this->shell->execute('echo \'Updating time: \'$(date) | tee -a ' . $installUpgradeLog);
100101
$this->shell->execute(sprintf(
101102
'/bin/bash -c "set -o pipefail; %s | tee -a %s"',
102103
'php ./bin/magento setup:upgrade --keep-generated --ansi --no-interaction ' . $verbosityLevel,
103-
$this->fileList->getInstallUpgradeLog()
104+
$installUpgradeLog
104105
));
105106
} catch (\RuntimeException $exception) {
106107
//Rollback required by database

src/Test/Unit/Process/Deploy/InstallUpdate/Install/SetupTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function testExecute(
187187
$this->shellMock->expects($this->exactly(2))
188188
->method('execute')
189189
->withConsecutive(
190-
["echo 'Installation time: '$(date)"],
190+
['echo \'Installation time: \'$(date) | tee -a ' . $installUpgradeLog],
191191
['/bin/bash -c "set -o pipefail;'
192192
. ' php ./bin/magento setup:install -n --session-save=db --cleanup-database --currency=\'USD\''
193193
. ' --base-url=\'http://unsecure.url\' --base-url-secure=\'https://secure.url\' --language=\'fr_FR\''

src/Test/Unit/Process/Deploy/InstallUpdate/Update/SetupTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function testExecute()
108108
$this->shellMock->expects($this->exactly(2))
109109
->method('execute')
110110
->withConsecutive(
111-
["echo 'Upgrading time: '$(date)"],
111+
['echo \'Updating time: \'$(date) | tee -a ' . $installUpgradeLog],
112112
['/bin/bash -c "set -o pipefail; php ./bin/magento setup:upgrade '
113113
. '--keep-generated --ansi --no-interaction -v | tee -a '
114114
. $installUpgradeLog . '"']

0 commit comments

Comments
 (0)