mardi 1 mars 2022

How to print custom message in try catch - php laravel

I need to write to log some data when exception occurred, since it is dynamic data and I need the message I tried with simple code, just to write 'Boom' if exception occurred. However just the automatic exception data written in logs (as before the try catch). can someone advise how to print to log in the catch?

try {
    $sheet->setCellValue($cell,$innervalue);
} catch(Exception $e) {
    $message = 'Can not set value: '.$innervalue .' in cell ' .$cell .$headerArray[$headerIndex];
    \Log::info('boom');
}

and in the logs nothing displayed enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire