Logs with laravel and queue

Hey team,

I don’t know but I can’t see any logs from my job or queue using the Log facade.

This is my conf ```
LOG_CHANNEL = “stderr”
LOG_LEVEL = “info”
LOG_STDERR_FORMATTER = “Monolog\Formatter\JsonFormatter”


And this is a case of log usage : 

Log::info(‘Trying with _ address’);

Hi!

Let’s see what we can dig up.

How’d you set your queue to run in your case? Was it using the [Processes] section (documented here)?

yes!

Ok, after trying to log from tinker after a ssh console; I noticed that nothing is logged and when i run multiple logs I get this : WARN Reaped child process with pid: 525 and signal: SIGKILL, core dumped? false

That error might be a machine stopping due to inactivity (where inactivity is measured by HTTP requests coming in).

In the container used for this, Supervisord is running everything - php-fpm, nginx, and the application.

Since Supervisord is the program running at the highest level (in the foreground), its the thing whose stderr/stdout output is getting collected by Fly’s logging mechanism.

To get Laravel output into into Fly’s logs, Supervisord is collecting Laravel output (from web requests!) and spitting them back out (so you can imagine Laravel outputting some log into to stderr, PHP-FPM seeing that and spitting it out its stderr, and finally supervisord seeing that, and spitting out to ITS stderr. It’s a chain of stuff, which is an unfortunate result of how PHP works).

That’s why log output from a tinker session over SSH would not end up in Fly. logs.

That all being said, I would think a second process defined in [processes] should get its stderr/stdout collected by the Fly logging mechanism! In that case, the php artisan queue:listen... command is the process run in the foreground and so its stderr output should be captured.

I’ll test that out.

Okay, I understand why it’s not working with Tinker, thanks! I’m still looking to on my side to understand what is the problem to.

I have a feeling cron/queues are outputting to stderr but the logging mechanism is listening for stdout. I’ll see if that’s the case!

Do you have any news about that, I’m still trying to have logs from laravel app to the fly monitoring but it’s still don’t working. I used this in my fly.toml

 LOG_CHANNEL = "stack"
 LOG_LEVEL = "info"
 LOG_STDERR_FORMATTER = "Monolog\\Formatter\\JsonFormatter"

and my stack is this ```
‘stack’ => [
‘driver’ => ‘stack’,
‘channels’ => [‘flare’, ‘stderr’],
‘ignore_exceptions’ => false,
],

Even for my HTTP request, for example I want to log something inside of middleware

Ok I think the issue is related with octane

Ok so I saw that :
Logging in requests is very slow · Issue #724 · laravel/octane · GitHub and I try to do the same but when i’m using this configuration, my website is on 500

driver'         => 'monolog',
    'level'          => env('LOG_LEVEL', 'debug'),
    'handler'        => ProcessHandler::class,
    'with'           => [
        'command' => 'cat >> /proc/1/fd/1',
    ],
    'formatter'      => JsonFormatter::class,
    'formatter_with' => [
        'includeStacktraces' => true,
    ],