当从Log
facade调用log方法时,它会将值为NULL的二进制数据重复写入laravel.log
文件。
我尝试了几种调用Log
facade的变体,结果都是一样的:
Log::channel('stack')->info("test");
Log::channel("single")->info('test');
Log::debug("test");
laravel.log
文件中的输出显示在随附的屏幕截图中
我尝试注解掉logging.php
文件中的所有通道,得到了相同的结果。
下面是logging.php
文件的未注解版本
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single']
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'stdout' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'with' => [
'stream' => 'php://stdout',
],
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/datadog.laravel.log'),
'level' => 'debug',
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'papertrail' => [
'driver' => 'monolog',
'level' => 'debug',
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
'cloudwatch' => [
'driver' => 'custom',
'name' => env('CLOUDWATCH_LOG_NAME', 'nova_api_laravel_logs'),
'region' => env('CLOUDWATCH_LOG_REGION', 'us-west-2'),
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID', ''),
'secret' => env('AWS_SECRET_ACCESS_KEY', '')
],
'stream_name' => env('CLOUDWATCH_LOG_STREAM_NAME', 'datadog.laravel.log'),
'retention' => env('CLOUDWATCH_LOG_RETENTION_DAYS', 14),
'group_name' => env('CLOUDWATCH_LOG_GROUP_NAME', '/ecs/nova-api/app'),
'version' => env('CLOUDWATCH_LOG_VERSION', 'latest'),
'formatter' => JsonFormatter::class,
'disabled' => env('DISABLE_CLOUDWATCH_LOG', false),
'via' => \Pagevamp\Logger::class,
],
],
];
我不确定我们是否能解码。
我们正在使用Laravel 8运行supervisord
1条答案
按热度按时间rkue9o1l1#
因为supervisord正在写入laravel.log文件,所以它发送了大量的二进制数据。从www.example.com中删除日志文件的路径supervisor.properties,使其无法写入docker容器的
laravel.log
,并重建docker容器后,它工作了。