Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export Logging #196

Closed
svenkraenkel opened this issue Jan 25, 2013 · 3 comments
Closed

Export Logging #196

svenkraenkel opened this issue Jan 25, 2013 · 3 comments

Comments

@svenkraenkel
Copy link

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
Copy link
Author

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

@riconeitzel
Copy link
Contributor

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

@verklov
Copy link
Contributor

verklov commented Feb 18, 2014

@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 verklov closed this as completed Feb 18, 2014
magento-team pushed a commit that referenced this issue Apr 3, 2015
VitaliyBoyko pushed a commit to VitaliyBoyko/magento2 that referenced this issue Nov 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants