Issue #2949419 by mfb, vsujeetkumar, gapple, Hardik_Patel_12, neclimdul,...
Issue #2949419 by mfb, vsujeetkumar, gapple, Hardik_Patel_12, neclimdul, dawehner, Sam152, xjm, alexpott: Pass the raw exception to logger implementations
// When running inside the testing framework, we relay the errors
// to the tested site by the way of HTTP headers.
@@ -167,10 +169,10 @@ function _drupal_log_error($error, $fatal = FALSE) {
// installer.
if(\Drupal::hasService('logger.factory')){
try{
// Provide the PHP backtrace to logger implementations. Add
// Provide the PHP backtrace and exception to logger implementations. Add
// 'severity_level' to the context to maintain BC and allow logging
// implementations to use it.
\Drupal::logger('php')->log($severity,'%type: @message in %function (line %line of %file) @backtrace_string.',$error+['backtrace'=>$backtrace,'severity_level'=>$severity]);
\Drupal::logger('php')->log($severity,'%type: @message in %function (line %line of %file) @backtrace_string.',$error+['backtrace'=>$backtrace,'exception'=>$exception,'severity_level'=>$severity]);
}
catch(\Exception$e){
// We can't log, for example because the database connection is not