Skip to content

Commit db238ee

Browse files
MAGETWO-13915: PSR-3: common interface for logging libraries.
- split debug and info log type to separate files
1 parent 6c71ee9 commit db238ee

File tree

11 files changed

+32
-10
lines changed

11 files changed

+32
-10
lines changed

app/code/Magento/Backend/Model/Menu.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function add(\Magento\Backend\Model\Menu\Item $item, $parentId = null, $i
5555
$index = intval($index);
5656
if (!isset($this[$index])) {
5757
$this->offsetSet($index, $item);
58-
$this->_logger->debug(
58+
$this->_logger->info(
5959
sprintf('Add of item with id %s was processed', $item->getId())
6060
);
6161
} else {
@@ -120,7 +120,7 @@ public function remove($itemId)
120120
if ($item->getId() == $itemId) {
121121
unset($this[$key]);
122122
$result = true;
123-
$this->_logger->debug(
123+
$this->_logger->info(
124124
sprintf('Remove on item with id %s was processed', $item->getId())
125125
);
126126
break;

app/code/Magento/Backend/Model/Menu/Director/Director.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function _getCommand($data, $logger)
2424
{
2525
$command = $this->_commandFactory->create($data['type'], ['data' => $data]);
2626
if (isset($this->_messagePatterns[$data['type']])) {
27-
$logger->debug(
27+
$logger->info(
2828
sprintf($this->_messagePatterns[$data['type']], $command->getId())
2929
);
3030
}

app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ public function isZipCodeRequired($countryId = null)
568568
protected function _debug($debugData)
569569
{
570570
if ($this->getDebugFlag()) {
571-
$this->_logger->info($debugData);
571+
$this->_logger->debug($debugData);
572572
}
573573
}
574574

app/code/Magento/Ups/Model/Carrier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ protected function _parseCgiResponse($response)
515515
$message = __(
516516
'Sorry, something went wrong. Please try again or contact us and we\'ll try to help.'
517517
);
518-
$this->_logger->info($message . ': ' . $errorTitle);
518+
$this->_logger->debug($message . ': ' . $errorTitle);
519519
break;
520520
case 6:
521521
if (in_array($row[3], $allowedMethods)) {

app/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
<argument name="handlers" xsi:type="array">
9898
<item name="exception" xsi:type="object">Magento\Framework\Logger\Handler\Critical</item>
9999
<item name="system" xsi:type="object">Magento\Framework\Logger\Handler\System</item>
100+
<item name="debug" xsi:type="object">Magento\Framework\Logger\Handler\Debug</item>
100101
</argument>
101102
</arguments>
102103
</type>

lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ protected function _prepareDestination($destination = null, $newName = null)
675675
try {
676676
$this->directoryWrite->create($this->directoryWrite->getRelativePath($destination));
677677
} catch (\Magento\Framework\Filesystem\FilesystemException $e) {
678-
$this->logger->info($e->getMessage());
678+
$this->logger->critical($e);
679679
throw new \Exception('Unable to write file into directory ' . $destination . '. Access forbidden.');
680680
}
681681
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
4+
*/
5+
6+
namespace Magento\Framework\Logger\Handler;
7+
8+
use Monolog\Logger;
9+
10+
class Debug extends System
11+
{
12+
/**
13+
* @var string
14+
*/
15+
protected $fileName = '/var/log/debug.log';
16+
17+
/**
18+
* @var int
19+
*/
20+
protected $loggerType = Logger::DEBUG;
21+
}

lib/internal/Magento/Framework/Logger/Handler/System.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class System extends StreamHandler
1919
/**
2020
* @var int
2121
*/
22-
protected $loggerType = Logger::DEBUG;
22+
protected $loggerType = Logger::INFO;
2323

2424
/**
2525
* @var DriverInterface

lib/internal/Magento/Framework/Message/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public function addException(\Exception $exception, $alternativeText, $group = n
258258
$exception->getTraceAsString()
259259
);
260260

261-
$this->logger->debug($message);
261+
$this->logger->critical($message);
262262
$this->addMessage($this->messageFactory->create(MessageInterface::TYPE_ERROR, $alternativeText), $group);
263263
return $this;
264264
}

lib/internal/Magento/Framework/View/Layout/Generator/Block.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ protected function getBlockInstance($block, array $arguments = [])
172172
try {
173173
$block = $this->blockFactory->createBlock($block, $arguments);
174174
} catch (\ReflectionException $e) {
175-
$this->logger->info($e->getMessage());
175+
$this->logger->critical($e->getMessage());
176176
}
177177
}
178178
if (!$block instanceof \Magento\Framework\View\Element\AbstractBlock) {

0 commit comments

Comments
 (0)