type=$type; $this->logging(); } public function logging() { \Illuminate\Support\Facades\Log::info("抓取内存耗尽错误",debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT,5)); if (substr($this->getFile(),-(strlen("FatalError.php")))==='FatalError.php'){ \Illuminate\Support\Facades\Log::emergency("FPM内存耗尽",["user"=>Auth::id(),"param"=>request()]); } $exception=$this; list( $className, $functionName, $tracesAll ) =(function()use($exception){ $traces=method_exists($exception,'getTraceAsString') ?($exception->getTraceAsString()??'') :''; if(!$traces)return ''; preg_match('/\#0.*?\: (.*?)(-\>|\:\:)(.*?)\(/', $traces, $result); return [$result[1]??'',$result[3]??'',$traces]; })(); LogService::log( $className, $functionName, ($exception->getMessage()??'') .'调用堆栈e:'.$tracesAll, Auth::id()??'', $this->type ); } }