ThinkPHP6.0ÈÕ־ûÓÐÊä³öµ½ÎļþÔõô½â¾ö
ÎÊÌâÐÎò
TP6ÖÐÊä³öÒ»ÌõÈÕÖ¾
use think\facade\Log; Log.debug("ÕâÊÇÒ»ÌõÈÕÖ¾")
µÇ¼ºó¸´ÖÆ
ÏÔ×Åconfig/log.php ÀïÉèÖõÄĬÈÏÊä³ö¾ÍÊÇ file,ÆäËû´úÂëʹÓÃÒ²Õý³£
ÔÚÒì³£´¦ÀíÎļþapp/ExceptionHandle.php ÖÐʹÓã¬Ï뽫¹ýʧÐÅÏ¢Êä³öµ½Îļþ£¬Àû±ãµ÷ÊÔÕÒbug
Log::error($e);
µÇ¼ºó¸´ÖÆ
Ö±½ÓÊä³öµ½ÁËÊä³öÁ÷£¬·µ»Ø¸øÁËÇ°¶Ë
{code: -1, msg: '¹ýʧ', data: null}{}
µÇ¼ºó¸´ÖÆ
µ¼ÖÂjsonÆÊÎöʧ°Ü
ÎÊÌâ½â¾ö
½«Òì³£¹¤¾ßתΪ×Ö·û´®¾Í¿ÉÒÔÁË
Log::error($e->getTraceAsString()); // »òÕßÖ¸¶¨Êä³öͨµÀ Log::channel('file')->error('Ò»Ìõ²âÊÔÈÕÖ¾');
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇThinkPHP6.0ÈÕ־ûÓÐÊä³öµ½ÎļþÔõô½â¾öµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£