我试图为我的laravel应用程序编写一个自定义日志,因为应用程序相当大,所以我想组织我的日志文件。
问题是,如果在任何时候应用程序错误,它写到laravel.log文件并杀死脚本,就像php一样。
例如,我有一个自定义日志库,如下所示
<?php
namespace App\Libraries\Logs;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Log;
class CustomLogsLibrary {
public function userError($error){
我在从控制台记录一些基本信息行时遇到了问题。在本地,这工作得很好,一切都会从web和控制台记录下来(错误,信息消息)。但在服务器上,错误日志记录工作正常,但当我自己调用logger并尝试记录一些信息消息时,它不起作用。
我使用的是Laravel 5.4版本。
这是一些用于测试目的的App\Console\Commands\DummyCommand类。
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Log\Writer as Log;
class DummyCommand exte
我的队列任务如下
$message = "message";
Queue::push(function($job) use ($message)
{
echo "user of queue runnur : ".get_current_user();
Log::info($data,$message.get_current_user());
$job->delete();
});
但是我得到了
user of queue runnur : webapp
The stream or file "/var/app/current
我无法用Log外观记录作业的句柄方法中的任何内容。使用此facade从控制器或应用程序的其他部分进行日志记录很好。
我在这里尝试过这样的解决方案:,但是它不适用于Laravel6.17,在这里:,但它不影响任何行为。
PHP7.2Laravel在Docker内部运行,带有高山图像和其他无关的
这是我的工作:
class MyJob implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
public f
我使用Laravel V7 事件(正在运行) class IssueUpdated
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $issue;
public $oldIssue;
public $user;
public function __construct($issue, $oldIssue, $user)
{
$this->issue = $issue;
$this->oldIssue = $oldI
我使用的是Ubuntu22.04和最新版本的 Desktop (4.11.1)和LaravelFramework9.26.1。
我试图按照列出的步骤创建一个新的Laravel项目。
当我运行./vendor/bin/sail up时,终端没有显示错误。但是当我尝试访问时,Laravel显示了这个
The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The ex
在我的Laravel应用程序中,我使用Nginx作为服务器。Ubuntu版本为21.10
我还想使用Laravel的控制台(Tinker)来记录内容。当我将www-data设置为包含日志的storage文件夹的所有者时,我可以通过localhost查看我的应用程序,但是我不能使用Tinker来记录信息,例如,我得到的Log::debug("test");:
UnexpectedValueException with message 'The stream or file
"/var/www/laravel-app/storage/logs/laravel.lo
当我的站点登录失败时,在laravel.log文件中记录错误。我使用laravel护照进行api认证。
错误:
[2018-08-06 13:27:35] local.ERROR: League\OAuth2\Server\Exception\OAuthServerException: The user credentials were incorrect. in /home/roberto/new_site/vendor/league/oauth2-server/src/Exception/OAuthServerException.php:128
如何禁用oauth日志?
我正在使用Laravel,我的问题是不能从控制器传递参数。这是我的密码:
protected $id;
public function __construct($id)
{
$this->id = $id;
}
public function handle()
{
Log::info($this->id);
}
控制器
public function getAccept($id)
{
$job = (new SendQueueMail($id))->delay(10);
$this->dispatch($job);
}
我尝
现在我使用的是一个日志文件,但是需要每天使用它,但是对于当前日期,文件名必须是laravel.log
laravel-2020-08-30.log
laravel-2020-08-31.log
laravel-202-009-01.log -> the current date must be laravel.log
`
是否有可能每天都能得到日志,但名字是这样的?
laravel.log
年长的(最多一周)的名字是这样命名的:
laravel-2020-08-30.log