magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Export Logging

Open svenkraenkel opened this issue 13 years ago • 3 comments

By activating logging via protected $_debugMode = true; I will get the following error: Tested with Magento 1.7.0.2 but the code in Magento 2 at this part is always the same: Fatal error: Undefined class constant 'LOG_DIRECTORY' in /var/www/magento-1.7.0.2/app/code/core/Mage/ImportExport/Model/Abstract.php on line 93 by calling Mage_ImportExport_Model_Scheduled_Operation::LOG_DIRECTORY. Function in Magento2 (2.0.0.0-dev39): /**

  • Log debug data to file.

  • Log file dir: var/log/import_export/%Y/%m/%d/%time%%operation_type%%entity_type%.log *

  • @param mixed $debugData

  • @return Mage_ImportExport_Model_Abstract */ public function addLogComment($debugData) { if (is_array($debugData)) { $this->_logTrace = array_merge($this->_logTrace, $debugData); } else { $this->_logTrace[] = $debugData; } if (!$this->_debugMode) { return $this; }

    if (!$this->_logInstance) {
        $dirName = date('Y' . DS .'m' . DS .'d' . DS);
        $fileName = join('_', array(
            str_replace(':', '-', $this->getRunAt()),
            $this->getScheduledOperationId(),
            $this->getOperationType(),
            $this->getEntity()
        ));
        $dirPath = Mage::getBaseDir('var') . DS . Mage_ImportExport_Model_Scheduled_Operation::LOG_DIRECTORY
            . $dirName;
        if (!is_dir($dirPath)) {
            mkdir($dirPath, 0777, true);
        }
        $fileName = substr(strstr(Mage_ImportExport_Model_Scheduled_Operation::LOG_DIRECTORY, DS), 1)
            . $dirName . $fileName . '.log';
        $this->_logInstance = Mage::getModel('Mage_Core_Model_Log_Adapter', array('fileName' => $fileName))
            ->setFilterDataKeys($this->_debugReplacePrivateDataKeys);
    }
    $this->_logInstance->log($debugData);
    return $this;
    

    } Function in Magento 1.7.0.2 and 1.5: /**

    • Log debug data to file.

    • Log file dir: var/log/import_export/%Y/%m/%d/%time%%operation_type%%entity_type%.log *

    • @param mixed $debugData

    • @return Mage_ImportExport_Model_Abstract */ public function addLogComment($debugData) { if (is_array($debugData)) { $this->_logTrace = array_merge($this->_logTrace, $debugData); } else { $this->_logTrace[] = $debugData; } if (!$this->_debugMode) { return $this; }

      if (!$this->logInstance) { $dirName = date('Y' . DS .'m' . DS .'d' . DS); $fileName = join('', array( str_replace(':', '-', $this->getRunAt()), $this->getScheduledOperationId(), $this->getOperationType(), $this->getEntity() )); $dirPath = Mage::getBaseDir('var') . DS . Mage_ImportExport_Model_Scheduled_Operation::LOG_DIRECTORY . $dirName; if (!is_dir($dirPath)) { mkdir($dirPath, 0777, true); } $fileName = substr(strstr(Mage_ImportExport_Model_Scheduled_Operation::LOG_DIRECTORY, DS), 1) . $dirName . $fileName . '.log'; $this->_logInstance = Mage::getModel('core/log_adapter', $fileName) ->setFilterDataKeys($this->_debugReplacePrivateDataKeys); } $this->_logInstance->log($debugData); return $this; } Is there an other way existing to set export logging to true outside the template?

svenkraenkel avatar Jan 25 '13 07:01 svenkraenkel

The template Enterprise_ImportExport_Model_Scheduled_Operation is still existing in enterprise but not community edition.

svenkraenkel avatar Jan 25 '13 13:01 svenkraenkel

same for 1.8.x – http://svn.magentocommerce.com/source/branches/1.8-trunk/app/code/core/Mage/ImportExport/Model/ <--- Scheduled/Operation.php missing

riconeitzel avatar Feb 13 '14 20:02 riconeitzel

@svenkraenkel , the team has looked at the issue and could not reproduce it. According to the description provided, the issue could not be reproduced on Magento 2, but is still valid for Magento 1.x. We created the appropriate ticket in the backlog of Magento 1.x. We are closing this issue in scope of Magento 2.

verklov avatar Feb 18 '14 09:02 verklov