Sentry not logging when PHP script running using Supervisor

Viewed 125

I have searched everywhere that is google but can't seem to find solution:

I am running php script in the background to process queued data using supervisor. I have added sentry/sdk to my project to log any errors within the running php script. However Sentry is not logging any errors to my Sentry server - even when I try to manually send some test. My supervisor configuration and scripts are as follows:

jobs.conf

[program:jobs]
command=php jobs.php -DFOREGROUND
directory=/var/www/html/
autostart=true
autorestart=true
startretries=5
startsecs=5
user=www-data
numprocs=2
process_name=%(program_name)s_%(process_num)02d
stderr_logfile=/var/log/supervisor/%(program_name)s_stderr.log
stderr_logfile_maxbytes=10MB
stdout_logfile=/var/log/supervisor/%(program_name)s_stdout.log
stdout_logfile_maxbytes=10MB

supervisord.conf

[unix_http_server]
file=/var/run/supervisor.sock
chmod=0770
chown=nobody:nogroup

[supervisord]
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
nodaemon=true
loglevel=debug

[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock

[include]
files=/etc/supervisor/conf.d/*.conf

jobs.php

<?php

// Composer autoload config file
require_once dirname(__DIR__) . '/vendor/autoload.php';

// Initialize sentry
Sentry\init(['dsn' => $_ENV['SENTRY_DSN']]);
\Sentry\captureException(new Error("This is a fake exception!"));
0 Answers
Related