I have created a Shell using CakePHP. I am writing the output to a file using the following command:
sitename/app/Console/cake customconsole >> errorlog.log
Everything seems to work here, but I am not getting the PHP notices or warnings. However, I can see the notices and warnings in the terminal.
Is there any way by which I can log the notices and warnings to my log file as well?
I have made the following changes in php.ini for CLI:
display_errors
Default Value: On
error_reporting
Default Value: E_ALL
I have also adjusted debug value to 1 in CakePHP.
Thanks
A proper written app should not throw notices and hard errors anyway. Besides the attempt to logging them I would invest more time in unit testing and avoiding errors and notices. Specially notices are not hard to correct.
I'm not sure and to lazy to test this right now for you, you can do it yourself, CakePHP is using the console streams for different states, so I guess in the case of a hard php error it's sending the output to the error stream (2).
See this page http://www.ibm.com/developerworks/linux/library/l-lpic1-v3-103-4/ section "Redirecting output" how to redirect all streams in one file.
Try it, it might be the solution.