You'd likely have to override or extend t he InteractsWithIO.php from Illuminate\Console\Concerns's line() method.
That or you use regex to find INFO: at t he start of the output stream.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys, I migrated from Lumen 9 + PHP-FPM to Laravel 10 + Octane (OpenSwoole) and now when I output anything to stdout on the beginning of the output there is automatically appended word "INFO". For example before the migration the JSON output looks like this:
{"index":"filebeat","body":{"game":"Winter Sport Mania","category":"uat_custom_login","data":{"user_id":"45f83dfb-316a-4dc4-bb9d-fcc31526be1d","country":"SK","platform":"web","ip":1441652793,"created_at":"2023.08.30 12:09:06"},"date":"2023-08-30T12:09:06+02:00"}}
Now it looks like this:
INFO {"index":"filebeat","body":{"game":"Winter Sport Mania","category":"qa_custom_login","data":{"user_id":"4e745e5d-2d0b-4c2a-9edf-b62da26467e1","country":"SK","platform":"web","ip":1441652793,"created_at":"2023.08.30 11:54:55"},"date":"2023-08-30T11:54:55+02:00"}}
The problem is that I have Filebeat+Logstash+ElasticSearch stack which takes the output as it is and store it. So now all the systems are failing becasue they cannot decode the JSON that is stored in ES (INFO on the beginning is in-validating the JSON). I am not using any Laravel Logging feature. I have my custom service which basically looks like this:
class StdoutDriver extends AbstractDriver
{
private $outputStream;
public function __construct()
{
$this->outputStream = fopen('php://stdout', 'w');
}
/**
* @param string $index
* @param string $game
* @param string $category
* @param array $data
* @return bool
*/
public function send(string $index, string $game, string $category, array $data)
{
return fwrite($this->outputStream, $this->encode(ElasticLogResource::response($index, $game, $category, $data)));
}
/**
* @param $data
* @return false|string
*/
private function encode($data)
{
return json_encode($data) . "\n" ?? '';
}
public function __destruct()
{
fclose($this->outputStream);
}
}
Does anybody know how to remove that INFO from the beginnning of the output? Thank you.
Please or to participate in this conversation.