Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

FirePhp displays wrong context

...
        $this->setShared('log', function ()
        {
            $logger = new \Phalcon\Logger\Multiple();
            $logger->push(new \Phalcon\Logger\Adapter\File(LOG_PATH));
            $logger->push(new \Phalcon\Logger\Adapter\Firephp());
            return $logger;
        });

...
catch (\Exception $e)
{
    $trace = $e->getTrace(); // correct trace with multiple items
    $app->log->critical("Caught Exception: " . $e->getMessage(), $trace);
}

causes

{
...
   "backtrace":[
      {
         "function":"format",
         "class":"Phalcon\\Logger\\Formatter\\Firephp",
         "type":"->"
      },
      {
         "function":"logInternal",
         "class":"Phalcon\\Logger\\Adapter\\Firephp",
         "type":"->"
      },
      {
         "function":"log",
         "class":"Phalcon\\Logger\\Adapter",
         "type":"->"
      },
      {
         "function":"log",
         "class":"Phalcon\\Logger\\Multiple",
         "type":"->"
      },
      {
         "file":"\/home\/user\/www\/index.php",
         "line":60,
         "function":"critical",
         "class":"Phalcon\\Logger\\Multiple",
         "type":"->"
      }
   ]
....

in browser headers instead of correct exception trace. Exception message displayed as expected.

As i know firephp is not supported extension.



5.1k
Accepted
answer
edited 26d ago

I see that debug context support was dropped for all loggers. It's very strange that any info about it in the Changelog, because in 3.0 it still exists like optional parameter https://olddocs.phalconphp.com/en/3.0.0/api/Phalcon%5FLogger%5FAdapter%5FFirephp.html