Skip to content

Commit b75399c

Browse files
committed
11882: It's not possible to enable "log to file" (debugging) in production mode. Psr logger debug method does not work by the default in developer mode
1 parent 44d2562 commit b75399c

File tree

7 files changed

+39
-13
lines changed

7 files changed

+39
-13
lines changed

app/code/Magento/Backend/etc/adminhtml/di.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,18 @@
142142
<type name="Magento\Config\Model\Config\Structure\ConcealInProductionConfigList">
143143
<arguments>
144144
<argument name="configs" xsi:type="array">
145-
<item name="dev" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
145+
<item name="dev/restrict" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
146+
<item name="dev/front_end_development_workflow" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
147+
<item name="dev/template" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
148+
<item name="dev/translate_inline" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
149+
<item name="dev/js" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
150+
<item name="dev/css" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
151+
<item name="dev/image" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
152+
<item name="dev/static" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
153+
<item name="dev/grid" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
154+
<item name="dev/debug/template_hints_storefront" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
155+
<item name="dev/debug/template_hints_admin" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
156+
<item name="dev/debug/template_hints_blocks" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
146157
<item name="general/locale/code" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::DISABLED</item>
147158
</argument>
148159
</arguments>

app/code/Magento/Deploy/App/Mode/ConfigProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ConfigProvider
1616
* [
1717
* 'developer' => [
1818
* 'production' => [
19-
* {{setting_path}} => {{setting_value}}
19+
* {{setting_path}} => ['value' => {{setting_value}}, 'lock' => {{lock_value}}]
2020
* ]
2121
* ]
2222
* ]
@@ -41,7 +41,7 @@ public function __construct(array $config = [])
4141
* need to turn off 'dev/debug/debug_logging' setting in this case method
4242
* will return array
4343
* [
44-
* {{setting_path}} => {{setting_value}}
44+
* {{setting_path}} => ['value' => {{setting_value}}, 'lock' => {{lock_value}}]
4545
* ]
4646
*
4747
* @param string $currentMode

app/code/Magento/Deploy/Model/Mode.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,17 @@ protected function setStoreMode($mode)
205205
private function saveAppConfigs($mode)
206206
{
207207
$configs = $this->configProvider->getConfigs($this->getMode(), $mode);
208-
foreach ($configs as $path => $value) {
209-
$this->emulatedAreaProcessor->process(function () use ($path, $value) {
208+
foreach ($configs as $path => $item) {
209+
$this->emulatedAreaProcessor->process(function () use ($path, $item) {
210210
$this->processorFacadeFactory->create()->process(
211211
$path,
212-
$value,
212+
$item['value'],
213213
ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
214214
null,
215-
true
215+
$item['lock']
216216
);
217217
});
218-
$this->output->writeln('Config "' . $path . ' = ' . $value . '" has been saved.');
218+
$this->output->writeln('Config "' . $path . ' = ' . $item['value'] . '" has been saved.');
219219
}
220220
}
221221

app/code/Magento/Deploy/Test/Unit/Model/ModeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public function testEnableProductionModeMinimal()
226226
->method('getConfigs')
227227
->with('developer', 'production')
228228
->willReturn([
229-
'dev/debug/debug_logging' => 0
229+
'dev/debug/debug_logging' => ['value' => 0, 'lock' => false]
230230
]);
231231
$this->emulatedAreaProcessor->expects($this->once())
232232
->method('process')
@@ -245,7 +245,7 @@ public function testEnableProductionModeMinimal()
245245
0,
246246
ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
247247
null,
248-
true
248+
false
249249
);
250250
$this->outputMock->expects($this->once())
251251
->method('writeln')

app/code/Magento/Deploy/etc/di.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,24 @@
7575
<argument name="config" xsi:type="array">
7676
<item name="developer" xsi:type="array">
7777
<item name="production" xsi:type="array">
78-
<item name="dev/debug/debug_logging" xsi:type="string">0</item>
78+
<item name="dev/debug/debug_logging" xsi:type="array">
79+
<item name="value" xsi:type="string">0</item>
80+
<item name="lock" xsi:type="boolean">false</item>
81+
</item>
82+
</item>
83+
<item name="developer" xsi:type="array">
84+
<item name="dev/debug/debug_logging" xsi:type="array">
85+
<item name="value" xsi:type="string">1</item>
86+
<item name="lock" xsi:type="boolean">false</item>
87+
</item>
88+
</item>
89+
</item>
90+
<item name="production" xsi:type="array">
91+
<item name="developer" xsi:type="array">
92+
<item name="dev/debug/debug_logging" xsi:type="array">
93+
<item name="value" xsi:type="string">1</item>
94+
<item name="lock" xsi:type="boolean">false</item>
95+
</item>
7996
</item>
8097
</item>
8198
</argument>

app/code/Magento/Developer/etc/adminhtml/system.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<group id="debug" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
2929
<field id="debug_logging" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
3030
<label>Log to File</label>
31-
<comment>Not available in production mode.</comment>
3231
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
3332
</field>
3433
</group>

dev/tests/integration/testsuite/Magento/Developer/Model/Logger/Handler/DebugTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public function setUp()
9595

9696
// Preconditions
9797
$this->mode->enableDeveloperMode();
98-
$this->enableDebugging();
9998
if (file_exists($this->getDebuggerLogPath())) {
10099
unlink($this->getDebuggerLogPath());
101100
}

0 commit comments

Comments
 (0)