36

I was installing Magento 2 and got the following error.

    There has been an error processing your request
    Exception printing is disabled by default for security reasons.
    Error log record number: 354086296325

In Magento 1, I used to rename local.xml.sample to local.xml in errors folder and see the exception on the webpage itself instead of checking the file in var folder. How do I do the same in Magento 2 as I don't see errors folder?

  • check in var/log, var/report ... – uscoding Mar 31 '15 at 4:12
  • Hi, You can use developer mode to enable exception printing in magento 2. By default its set to default mode hence no exception printing. – Bhargav Mehta Dec 5 '15 at 6:41
47

It's similar to Magento 1, but local.xml.sample is located in pub/errors.

Just rename local.xml.sample to local.xml within pub/errors directory.

  • 5
    use magento developer mode as well php bin/magento deploy:mode:set developer – webkul Jan 13 '16 at 7:14
4

In Magento 2, local.xml.sample file is located in pub/errors/ You just need to rename local.xml.sample to local.xml enter image description here

Now, the error log will not be generic but detailed like this

You can also turn on developer mode in Magento 2 by entering this line in Magento CLI: php bin/magento deploy:mode:set developer

Referrence source: http://magentoexplorer.com/magento-exception-printing-is-disabled-by-default-for-security-reasons-how-to-fix (This tutorial include both Magento 1 and Magento 2, scroll down you will see Debug for Magento 2)

0

You can also print exception directly by modifying magento2/pub/errors/report.php file as per below code :

<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

require_once 'processorFactory.php';

$processorFactory = new \Magento\Framework\Error\ProcessorFactory();
$processor = $processorFactory->createProcessor();
if (isset($reportData) && is_array($reportData)) {
    $processor->saveReport($reportData);

    //Added code
    echo "<pre>";
    print_r($reportData);
    exit;

}
$response = $processor->processReport();
$response->sendResponse();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.