在laravel 8.0中尝试记录事件时,调用未定义的方法



所以我试图记录一个事件(如果不成功(,但我总是收到这个错误

调用未定义的方法Monolog\Logger::single((这是我为app/console/commands目录中的控制器编写的代码。

<?php
namespace AppConsoleCommands;
use IlluminateConsoleCommand;
use SymfonyComponentProcessExceptionProcessFailedException;
use SymfonyComponentProcessProcess;
use IlluminateSupportFacadesLog;
class FPTrainCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'FPTrain:command';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
date_default_timezone_set('EST');
$FPTree_date = date("Y-m-d");
$my_array = array("$FPTree_date","association", "test");
$FPJson = json_encode($my_array);
$process = new Process(["python3", "public/python/FP_Tree.py", "$FPJson"]);
$process->run();
// executes after the command finishes
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
$date = date('l jS of F Y h:i:s A');
}
Log::single("$FPTree_date Error Executing the daily association script");
echo $FPJson;
//dump(json_decode($process->getOutput(), true));
}
}

我不确定我做错了什么。

感谢的帮助

laravel日志中没有单一的方法。

根据https://laravel.com/docs/8.x/logging,这些是你可以使用的功能:

Log::emergency($message);
Log::alert($message);
Log::critical($message);
Log::error($message);
Log::warning($message);
Log::notice($message);
Log::info($message);
Log::debug($message);

最新更新