您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 咸宁分类信息网,免费分类信息发布

laravel在终端中查看日志的方法

2024/2/28 0:38:05发布23次查看
这篇文章主要介绍了关于laravel在终端中查看日志的方法,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
php artisan tail  --path=/users/henryj/workspace_php/makerlab/app/storage/logs/laravel-2015-04-22.log  在mac book终端中运行的指令
使用 `php artisan tail` 来实时查看 laravel 应用程序的 log说明php artisan tail 命令可用来查看实时的程序运行 log, 在 debug 模式关闭的情况下 ( 如: 生产环境 ), 尤其有用.
使用开发使用默认情况下 tail 只是针对本地的代码
php artisan tail
开发的时候, 还可以打开 sql 查询语句的 log, 配合 php artisan tail 一起使用, 对 sql 进行监控和调优.
在 app/filters.php 里面加上
event::listen('illuminate.query', function($query, $bindings, $time, $name){$data = compact('bindings', 'time', 'name'); // format binding data for sql insertionforeach ($bindings as $i => $binding){if ($binding instanceof \datetime){$bindings[$i] = $binding->format('\'y-m-d h:i:s\'');}else if (is_string($binding)){$bindings[$i] = "'$binding'";}} // insert bindings into query$query = str_replace(array('%', '?'), array('%%', '%s'), $query);$query = vsprintf($query, $bindings);log::info($query, $data);});
生产环境下的 log
接下来我们做些配置, 查看生产环境下的 log .
修改app/config/remote.php 文件'connections' => array('production' => array('host' => '117.111.111.111', // 'username' => 'root','password' => '','key' => '/users/username/.ssh/id_rsa','keyphrase' => '','root' => '/var/webroot',),),
服务器验证可以选择 用户名密码 方式, 也可以设置 key.
配置完成后调用:
php artisan tail production --path=/var/www/omapi/app/storage/logs/fpm-fcgi-2014-12-12.log --env=local
就可以实时查看 log 输出了:
查看支持的参数php artisan help tail
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注!
相关推荐:
laravel5 快速认证逻辑流程的分析
以上就是laravel在终端中查看日志的方法的详细内容。
咸宁分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录