如何在Laravel 5.1中为logging INFO指定一个单独的文件?
How to specify a separate file for logging INFO in Laravel 5.1?
任何立即的帮助都将是非常可观的.谢谢
Any immediate help will be highly appreciable. Thanks
是否要将 info 专门记录到一个日志文件并将另一种日志类型记录到另一个位置?在这种情况下,我的解决方案可能无济于事,但仍然有用.
Do you want to specifically log info to one log file and another log type to another location? My solution might not help in that case, but could still be useful.
要将日志文件写入另一个位置,请使用方法 useDailyFiles 或 useFiles,然后使用 info 方法将日志文件记录到您刚刚指定的路径中.像这样:
To write a log file to another location, use the method useDailyFiles or useFiles, and then info to log to the log file at the path you just specified. Like so:
Log::useDailyFiles(storage_path().'/logs/name-of-log.log');
Log::info([info to log]);
这两种方法的第一个参数是日志文件的路径(如果它不存在则创建),对于 useDailyFiles 第二个参数是 Laravel 将记录的天数在擦除旧日志之前.默认值是无限制的,所以在我的例子中我没有输入值.
The first parameter for both methods is the path of the log file (which is created if it doesn't already exist) and for useDailyFiles the second argument is the number of days Laravel will log for before erasing old logs. The default value is unlimited, so in my example I haven't entered a value.
这篇关于Laravel:如何记录信息以分隔文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在 Laravel 集合对象中添加新元素add new element in laravel collection object(在 Laravel 集合对象中添加新元素)
在 Laravel 5 中创建编辑模式Creating an edit modal in Laravel 5(在 Laravel 5 中创建编辑模式)
用于集合的 Laravel 5.5 API 资源(独立数据)Laravel 5.5 API resources for collections (standalone data)(用于集合的 Laravel 5.5 API 资源(独立数据))
在 php Laravel 5 中创建自定义辅助函数的最佳实践What is the best practice to create a custom helper function in php Laravel 5?(在 php Laravel 5 中创建自定义辅助函数的最佳实践是什么
没有“Access-Control-Allow-Origin"标头 - LaravelNo #39;Access-Control-Allow-Origin#39; header - Laravel(没有“Access-Control-Allow-Origin标头 - Laravel)
Laravel Passport Route 重定向到登录页面Laravel Passport Route redirects to login page(Laravel Passport Route 重定向到登录页面)