1

Is there a way to have an explicit excpetion.log file that gives you all the details and doesn't ommit anything with the (...) ?

Mage_Core_Model_App->dispatchEvent('catalog_control...', Array)

Thank you in advance.

1

Check out this answer on stackoverflow: https://stackoverflow.com/a/12358464/387136

Below a snippet from the answer

I've added a function, which I got from Steve (How can I get the full string of PHP’s getTraceAsString()) to app\code\core\Mage\Core\functions.php

    function getExceptionTraceAsString($exception) {
        $rtn = "";
        $count = 0;
        foreach ($exception->getTrace() as $frame) {
            $args = "";
            if (isset($frame['args'])) {
                $args = array();
                foreach ($frame['args'] as $arg) {
                    if (is_string($arg)) {
                        $args[] = "'" . $arg . "'";
                    } elseif (is_array($arg)) {
                        $args[] = "Array";
                    } elseif (is_null($arg)) {
                        $args[] = 'NULL';
                    } elseif (is_bool($arg)) {
                        $args[] = ($arg) ? "true" : "false";
                    } elseif (is_object($arg)) {
                        $args[] = get_class($arg);
                    } elseif (is_resource($arg)) {
                        $args[] = get_resource_type($arg);
                    } else {
                        $args[] = $arg;
                    }
                }
                $args = join(", ", $args);
            }
            $rtn .= sprintf( "#%s %s(%s): %s%s(%s)\n",
                $count,
                $frame['file'],
                $frame['line'],
                isset($frame['class']) ? $frame['class'] . '->' : '',
                $frame['function'],
                $args );
            $count++;
        }
        return $rtn;
    }

I've modified Mage.php file (printException method) - instead of $e->getTraceAsString() I've inserted getExceptionTraceAsString($e) - notice that there's two appearances: for Debug mode on, and off.

The above logic only modifies Error/report output; to add this logic to Exception log as well you'll want to modify the Mage::logException method - change

self::log("\n" . $e->__toString(), Zend_Log::ERR, $file);

with

self::log("\n" . $e->getMessage() . getExceptionTraceAsString($e), Zend_Log::ERR, $file);

Hope it helps!

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.