尊龙凯时人生就是博

laravel logÔÚÄÄ

ÔÚ¿ª·¢Àú³ÌÖÐ £¬Ðí¶àʱ¼äÐèÒªÉó²éÓ¦ÓóÌÐò¼Í¼µÄÈÕÖ¾ £¬ÒÔ±ã¾ÙÐе÷ÊԺ͹ÊÕÏɨ³ý¡£laravel ×÷Ϊһ¿îÓÅÒìµÄ php ¿ò¼Ü £¬×ÔȻҲÌṩÁ˺ܺõÄÈÕÖ¾¼Í¼¹¦Ð§¡£¿ÉÊÇ £¬¹ØÓÚ³õѧ laravel µÄ¿ª·¢ÕßÀ´Ëµ £¬¿ÉÄÜ»áÓöµ½ laravel log ÔÚÄĵÄÎÊÌâ¡£ÏÂÃæ £¬±¾ÎĽ«Îª¸÷ÈËÏÈÈÝ laravel µÄÈÕÖ¾¼Í¼¹¦Ð§ÒÔ¼°ÔõÑùÕÒµ½ laravel µÄÈÕÖ¾Îļþ¡£

Laravel ÈÕÖ¾¼Í¼¹¦Ð§

ÔÚ Laravel ÖÐ £¬ÈÕÖ¾¼Í¼ÊǺÜÊÇÖ÷ÒªµÄÒ»ÏЧ £¬Laravel ÄÚÖõÄÈÕÖ¾¹¦Ð§¿ÉÒԼͼӦÓóÌÐòÖеÄÖÖÖÖÊÂÎñºÍ¹ýʧ £¬ÒÔ±ãÓÚ¾ÙÐÐÅŲéºÍÐÞÕý¡£Laravel ÌṩÁ˶à¸öÈÕÖ¾Çý¶¯³ÌÐò £¬°üÀ¨ file¡¢syslog¡¢errorlog¡¢monolog µÈ¡£Ä¬ÈÏÇéÐÎÏ £¬Laravel ʹÓà file ÈÕÖ¾Çý¶¯³ÌÐò £¬¼Í¼ÈÕÖ¾ÎļþµÄλÖÃÔÚ Laravel ÏîÄ¿µÄ storage/logs Ŀ¼Ï¡£

ÔÚ Laravel ÖÐ £¬¼Í¼ÈÕÖ¾ºÜÊǼòÆÓ £¬Ö»ÐèҪʹÓà Log ÀàÌṩµÄÒªÁì¼´¿É£º

use IlluminateSupportFacadesLog;

Log::info('This is an information message.');
Log::warning('This is a warning message.');
Log::error('This is an error message.');

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂëÖÐ £¬»®·ÖʹÓÃÁË info¡¢warning ºÍ error ÒªÁì¼Í¼ÁËÈýÖÖ¼¶±ðµÄÈÕÖ¾ÐÅÏ¢¡£Laravel ÌṩÁË 8 ÖÖ¼¶±ðµÄÈÕÖ¾ÐÅÏ¢ £¬»®·ÖΪ emergency¡¢alert¡¢critical¡¢error¡¢warning¡¢notice¡¢info ºÍ debug¡£¿ª·¢Õß¿ÉÒÔƾ֤ÏÖÕæÏàÐÎÑ¡ÔñºÏÊʵÄÈÕÖ¾¼¶±ð¾ÙÐмͼ¡£

ÉÏÊö´úÂëÒ²¿ÉÒÔд³ÉÁ´Ê½Å²Óõķ½·¨£º

Log::channel('stack')
    ->emergency('This is an emergency message.')
    ->alert('This is an alert message.')
    ->critical('This is a critical message.')
    ->error('This is an error message.')
    ->warning('This is a warning message.')
    ->notice('This is a notice message.')
    ->info('This is an info message.')
    ->debug('This is a debug message.');

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂëÖÐ £¬Ê¹ÓÃÁË channel ÒªÁìÖ¸¶¨ÁËÈÕ־ƵµÀ £¬È»ºóʹÓø÷ÒªÁì¼Í¼Á˲î±ð¼¶±ðµÄÈÕÖ¾ÐÅÏ¢¡£

Laravel ÈÕÖ¾ÎļþλÖÃ

ÔÚ Laravel ÖÐ £¬Ä¬ÈÏÇéÐÎÏ £¬ÈÕÖ¾ÎļþµÄλÖÃΪ storage/logs/laravel-2021-05-13.log £¬ÆäÖÐ £¬laravel-2021-05-13.log ΪĿ½ñÈÕÆÚµÄÈÕÖ¾Îļþ¡£Ò²¾ÍÊÇ˵ £¬µ±ÎÒÃÇÔÚ 2021 Äê 5 Ô 13 ÈռͼÈÕ־ʱ £¬±¬·¢µÄÈÕÖ¾ÎļþÃû³Æ¾ÍÊÇ laravel-2021-05-13.log¡£

ËäÈ» £¬ÎÒÃÇÒ²¿ÉÒÔÊÖ¶¯¼Í¼ÈÕÖ¾ÎļþÃû £¬Ê¹ÓÃÈçÏ´úÂ룺

Log::useFiles('path/to/your/logfile.log');

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂëÖÐ £¬useFiles ÒªÁì¿ÉÒÔÖ¸¶¨ÈÕÖ¾ÎļþµÄλÖúÍÃû³Æ £¬¿ª·¢Õß¿ÉÒÔƾ֤ÐèÒª¾ÙÐе÷½â¡£

ÕÒµ½ Laravel ÈÕÖ¾Îļþ

ÔÚĬÈÏÇéÐÎÏ £¬Laravel µÄÈÕÖ¾ÎļþλÓÚ storage/logs Ŀ¼Ï¡£¿ÉÊÇ £¬ÔÚÉú²úÇéÐÎÏ £¬ÓÉÓÚÇå¾²Ôµ¹ÊÔ­ÓÉ £¬»á¼û¸ÃĿ¼¿ÉÄÜ»áÊܵ½ÏÞÖÆ¡£Õâʱ¼ä £¬ÎÒÃÇ¿ÉÒÔÔÚ .env ÎļþÖÐÉèÖà LOG_CHANNEL ÇéÐαäÁ¿ £¬ÒÔʹÓÃÆäËüµÄÈÕÖ¾Çý¶¯³ÌÐò £¬Èç syslog »ò errorlog¡£

Ê×ÏÈ £¬ÈôÊÇÎÒÃÇʹÓõÄÊÇ file ÈÕÖ¾Çý¶¯³ÌÐò £¬ÄÇôÐèҪȷ±£ storage/logs Ŀ¼ÓÐ׼ȷµÄȨÏÞ¡£ÀýÈç £¬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´¸ü¸ÄĿ¼µÄȨÏÞ£º

chmod -R 777 storage/logs/

µÇ¼ºó¸´ÖÆ

ÈôÊÇÎÒÃÇʹÓõÄÊÇÆäËüÈÕÖ¾Çý¶¯³ÌÐò £¬¶ø²»ÊÇ file £¬ÔòÐèÒª½«ÈÕÖ¾ÐÅÏ¢¼Í¼µ½ÏµÍ³ÈÕÖ¾»òÕßÓ¦ÓóÌÐòÈÕÖ¾ÖС£ÀýÈç £¬¿ÉÒÔ½«ÈÕÖ¾ÐÅÏ¢¼Í¼µ½ syslog ÖÐ £¬È»ºóʹÓà syslog ¹¤¾ßÉó²éÈÕÖ¾ÐÅÏ¢¡£Ò²¿ÉÒÔ½«ÈÕÖ¾ÐÅÏ¢¼Í¼µ½Ó¦ÓóÌÐòÈÕÖ¾ÖÐ £¬ÀýÈç Apache »ò Nginx µÄ»á¼ûÈÕÖ¾ £¬È»ºóʹÓÃÏìÓ¦µÄ¹¤¾ß»òÏÂÁî¾ÙÐÐÉó²é¡£

×ÜÖ® £¬ÈôÊÇÄãÏëÕÒµ½ Laravel µÄÈÕÖ¾Îļþ £¬ÄÇôÄãÐèÒªÏÈÈ·¶¨ÄãʹÓõÄÊÇÄÄÖÖÈÕÖ¾Çý¶¯³ÌÐò £¬È»ºóÉó²éÏìÓ¦µÄÈÕÖ¾Îļþ»òÈÕÖ¾¹¤¾ß¡£Æ¾Ö¤ÄãµÄÏÖÕæÏàÐÎ £¬¾öÒéʹÓÃÄÄÖÖÈÕÖ¾Çý¶¯³ÌÐòºÍ¼Í¼·½·¨¡£

×ܽá

±¾ÎÄÏÈÈÝÁË Laravel µÄÈÕÖ¾¼Í¼¹¦Ð§ÒÔ¼°ÔõÑùÕÒµ½ Laravel µÄÈÕÖ¾Îļþ¡£Laravel Ϊ¿ª·¢ÕßÌṩÁ˱ã½ÝµÄÈÕÖ¾¼Í¼¹¦Ð§ £¬¿ÉÒÔºÜÀû±ãµØ¼Í¼ӦÓóÌÐòµÄÖÖÖÖÊÂÎñºÍ¹ýʧÐÅÏ¢ £¬ÒÔ±ãÓÚ¾ÙÐÐÅŲéºÍÐÞ¸´¡£µ±¿ª·¢ÕßÐèÒªÉó²éÈÕÖ¾Îļþʱ £¬ÐèҪƾ֤ÏÖÕæÏàÐÎÑ¡ÔñºÏÊʵÄÈÕÖ¾Çý¶¯³ÌÐòºÍ¼Í¼·½·¨À´Éó²éÈÕÖ¾Îļþ¡£

ÒÔÉϾÍÊÇlaravel logÔÚÄĵÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ