Created
June 16, 2015 19:54
-
-
Save OwlyCode/481ac04e13035ec6760d to your computer and use it in GitHub Desktop.
Php error logging to stderr using Docker's official php:5.6-apache image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Debug\ErrorHandler; | |
use Symfony\Component\Debug\ExceptionHandler; | |
require_once __DIR__.'/vendor/autoload.php'; | |
ErrorHandler::register(); | |
$handler = ExceptionHandler::register(false); | |
$handler->setHandler(function (\Exception $e) { | |
$output = fopen('php://stderr', 'w'); | |
fwrite($output, sprintf("%s\n%s\n", $e->getMessage(), $e->getTraceAsString())); | |
}); | |
$app = require __DIR__ . '/app.php'; | |
$app->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment