Sorry, we don't support your browser.  Install a modern browser
This post is closed.

Provide access to whoops error handler#371


As far as I understand, it is currently not possible to log all errors that Kirby catches to a file (or am I wrong?). This would be a great feature for production use.

If Kirby doesn’t want to add this in core, it could provide public access to the Whoops instance, so that one can easily add a handler and do whatever one wants with the caught errors.

In my case, I solved this by extending \Kirby\Cms\App:

use Kirby\Cms\App;
use Whoops\Handler\CallbackHandler;
use Whoops\Handler\Handler;

class MyApp extends App
    public function enableErrorLogs()
        // Create a new Whoops handler that simply logs the exception and continues running the next handler
        $handler = new CallbackHandler(function ($exception, $inspector, $run) {
                    'PHP error: %s (%s) | URI: %s | Trace: %s',
                    isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : 'unknown',
            return Handler::DONE;


$kirby = new MyApp();
echo $kirby->render();

If the whoops() getter would be public, I could do this without extending the App class itself.

Related issues:

a year ago

We have a work-in-progress pull request for this here:

10 months ago
Changed the status to
In progress
10 months ago
Changed the status to
In upcoming releases
10 months ago

Wow, awesome, thanks for taking action so fast!

10 months ago

It’s a coincidence as we were working on this before. :)

10 months ago
Changed the status to
10 months ago