zoukankan      html  css  js  c++  java
  • Laravel-错误调试与记录日志

    Laravel-错误调试与记录日志

    标签(空格分隔): php


    错误调试

    配置

    修改/config/app.php
    
    'debug' => env('APP_DEBUG', true),
    
    开启debug为true 当代码有错误时会有提示,不然的话 [Whoops, looks like something went wrong.] 一头雾水不知道什么意思
    

    效果

    记录日志

    配置

    修改/config/app.php
    
    /*
    |--------------------------------------------------------------------------
    | Logging Configuration
    |--------------------------------------------------------------------------
    |
    | Here you may configure the log settings for your application. Out of
    | the box, Laravel uses the Monolog PHP logging library. This gives
    | you a variety of powerful log handlers / formatters to utilize.
    |
    | Available Settings: "single", "daily", "syslog", "errorlog"
    |
    */
    
    'log' => env('APP_LOG', 'single'),
    
    'log_level' => env('APP_LOG_LEVEL', 'debug'),
    
    有 Available Settings: "single", "daily", "syslog", "errorlog" 这几个选项
    

    操作

    该日志记录器提供了RFC 5424中定义的八种日志级别:emergency、alert、critical、error、warning、notice、info 和 debug
    
    Log::emergency($error);
    Log::alert($error);
    Log::critical($error);
    Log::error($error);
    Log::warning($error);
    Log::notice($error);
    Log::info($error);
    Log::debug($error);
    
    ----------------------------
    
    也可以通过辅助函数
    info($error) info级别
    logger($error) debug级别
  • 相关阅读:
    自定义中间件
    haha
    博客园使用教程(皮毛)
    购物车
    计算器
    python格式化while循环
    JS弹出框、对话框、提示框,JS关闭窗口、关闭页面和JS控制页面跳转
    CentOS平台下的Docker安装与启动
    面向接口编程详解(一)——思想基础
    三目运算符详解
  • 原文地址:https://www.cnblogs.com/yanweifeng/p/9505424.html
Copyright © 2011-2022 走看看