Laravel 5-更改默认日志位置,将日志文件移至应用程序外部 [英] Laravel 5 - change default log location, move log file outside the app

查看:542
本文介绍了Laravel 5-更改默认日志位置,将日志文件移至应用程序外部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将默认日志文件位置<project-name>/storage/logs/laravel.log更改为类似/var/logs/<project-name>/laravel.log的内容?

How can I change default log file location <project-name>/storage/logs/laravel.log to something like /var/logs/<project-name>/laravel.log?

推荐答案

我通过使用 errorlog 日志记录模型并配置Web服务器.

I resolved this case by using errorlog logging model and configuring webserver.

1.配置Laravel:

config/app.php配置文件中:

'log' => 'errorlog'

详细了解Laravel日志配置: http://laravel.com/docs/5.1/errors #configuration

Read more about Laravel log configuration: http://laravel.com/docs/5.1/errors#configuration

2.配置Web服务器(在我的情况下为Nginx):

error_log    /var/log/nginx/<project_name>-error.log;

这篇关于Laravel 5-更改默认日志位置,将日志文件移至应用程序外部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆