![]() |
Send errors to stderr instead of stdout - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29) +--- Thread: Send errors to stderr instead of stdout (/showthread.php?tid=91467) |
Send errors to stderr instead of stdout - Fred9176 - 08-14-2024 Hi, Is there a way to send PHP/CI4.5 generated errors to stderr instead of stdout ? For eg, I have a crontab which sends an email only when it detects content on stderr : PHP Code: */10 * * * * root php myscript.php > /dev/null Here are some examples to illustrate the different scenarii: PHP Code: public function test() => No mail sent => OK because written to stdout public function test() PHP Code: { public function test() PHP Code: { Thanks for your help, Fred RE: Send errors to stderr instead of stdout - InsiteFX - 08-14-2024 I found this may help but not sure. Email all cron stdout+stderr output only on stderr RE: Send errors to stderr instead of stdout - kenjis - 08-15-2024 (08-14-2024, 07:18 AM)Fred9176 Wrote: Is there a way to send PHP/CI4.5 generated errors to stderr instead of stdout ? Create your custom Exception Handler. See https://www.codeigniter.com/user_guide/general/errors.html#custom-exception-handlers RE: Send errors to stderr instead of stdout - Fred9176 - 08-16-2024 Thanks for your help. I finally found another wrapper script which fits my needs : https://stackoverflow.com/questions/44144898/redirect-stdout-to-stderr-when-exit-status-isnt-0-in-bash |