diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 3913de4de..a6f7734c3 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -2,6 +2,7 @@ namespace App\Exceptions; +use CloudLogger; use Config; use Throwable; use Illuminate\Http\Request; @@ -77,6 +78,14 @@ public function render($request, Throwable $e): mixed ]; } + if (env('GOOGLE_CLOUD_LOGGING_ENABLED')) { + CloudLogger::write([ + 'action_type' => 'EXCEPTION', + 'action_message' => $response['message'], + 'details' => $response['details'], + ]); + } + return response()->json($response, $statusCode); } } diff --git a/docker/start.sh b/docker/start.sh index a33cd6f21..c36681e2a 100755 --- a/docker/start.sh +++ b/docker/start.sh @@ -23,20 +23,21 @@ fi # Start the Octane server in the background $base_command & -# Separate the command from the cron timings, so as to first check for -# duplicates, thus being immune to multiple insertions -cronCommand="/usr/local/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1" -cronJob="* * * * * $cronCommand" +# for the dev, preprod and prod environment the scheduler was moved based on google scheduler. +if [ "$APP_ENV" = 'local' ]; then + # Separate the command from the cron timings, so as to first check for + # duplicates, thus being immune to multiple insertions + cronCommand="/usr/local/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1" + cronJob="* * * * * $cronCommand" -# To add the above to local crontab -( crontab -l | grep -v -F "$cronCommand" ; echo "$cronJob" ) | crontab - + # To add the above to local crontab + ( crontab -l | grep -v -F "$cronCommand" ; echo "$cronJob" ) | crontab - -## To remove the above from local crontab -# ( crontab -l | grep -v -F "$cronCommand" ) | crontab - + ## To remove the above from local crontab + # ( crontab -l | grep -v -F "$cronCommand" ) | crontab - -# To activate cron service -service cron start + # To activate cron service + service cron start +fi php artisan horizon - -