-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[BC Break][Debug] #2042 implementation of fatal error logging #6474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,9 @@ class Debug | |
* class loader is also registered. | ||
* | ||
* @param integer $errorReportingLevel The level of error reporting you want | ||
* @param Boolean $displayErrors Display errors (for dev environment) or just log they (production usage) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: |
||
*/ | ||
public static function enable($errorReportingLevel = null) | ||
public static function enable($errorReportingLevel = null, $displayErrors = true) | ||
{ | ||
if (static::$enabled) { | ||
return; | ||
|
@@ -42,10 +43,10 @@ public static function enable($errorReportingLevel = null) | |
|
||
error_reporting(-1); | ||
|
||
ErrorHandler::register($errorReportingLevel); | ||
ErrorHandler::register($errorReportingLevel, $displayErrors); | ||
if ('cli' !== php_sapi_name()) { | ||
ExceptionHandler::register(); | ||
} elseif (!ini_get('log_errors') || ini_get('error_log')) { | ||
} elseif (!ini_get('log_errors') || ini_get('error_log') && $displayErrors) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's not correct as && takes precedence over ||, see #7895 |
8000
||
ini_set('display_errors', 1); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,23 +17,27 @@ | |
use Symfony\Component\HttpKernel\KernelEvents; | ||
|
||
/** | ||
* Injects the logger into the ErrorHandler, so that it can log deprecation errors. | ||
* Injects the logger into the ErrorHandler, so that it can log various errors. | ||
* | ||
* @author Colin Frei <colin@colinfrei.com> | ||
* @author Konstantin Myakshin <koc-dp@yandex.ru> | ||
*/ | ||
class DeprecationLoggerListener implements EventSubscriberInterface | ||
class ErrorsLoggerListener implements EventSubscriberInterface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renaming the class is a BC break There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and changing its constructor is also a BC break There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This class not tagged with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renaming this class is ok for me as this is not a widely used class anyway (and it was added recently). |
||
{ | ||
private $channel; | ||
|
||
private $logger; | ||
|
||
public function __construct(LoggerInterface $logger = null) | ||
public function __construct($channel, LoggerInterface $logger = null) | ||
{ | ||
$this->channel = $channel; | ||
$this->logger = $logger; | ||
} | ||
|
||
public function injectLogger() | ||
{ | ||
if (null !== $this->logger) { | ||
ErrorHandler::setLogger($this->logger); | ||
ErrorHandler::setLogger($this->logger, $this->channel); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabpot Please suggest how can I enable listener that located in this file excluding loading all the file? Add
debug_prod.xml
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Splitting the file in two makes sense.