Reputation: 199
I have an issue, i need to be able to see the php error when debug mode is set as false on production environment.
I currently see the internal error message but i would like to see the php error in case things break.
How can i do this? I don't want to have the debug kit activated as well.
/**
* Debug Level:
*
* Production Mode:
* false: No error messages, errors, or warnings shown.
*
* Development Mode:
* true: Errors and warnings shown.
*/
'debug' => false,
Upvotes: 3
Views: 1092
Reputation: 268
If you want there is a plugin called error email cakephp, I use in my projects you install and define what kind of errors he might send you an email , it's very good and works on cakephp 3. You can find the project on github, its very documented.
Upvotes: 0
Reputation: 29121
Restricted DebugKit access
Depending on the security requirements of your application, you can implement some form of check to turn on debug mode while in production. For instance, a custom key
+ IP restriction.
So you can check to see if `$_GET['key'] is equal to your key AND the IP matches your machine. If so, turn debug on, otherwise, leave it off. This will allow you to much more easily debug your live application.
You are opening yourself a bit to potential concerns (though I'm not a good enough hacker to know any particular ones). But if you're doing banking level software, or storing any type of PCI-compliant data, you should probably not do this. Otherwise, it's a good solution.
Or, you could simply turn on debug kit if logged in as user with a specific role.
CakePHP Logs
As others have mentioned, you can use the internal Cake Logs via accessing them directly or, as Alex points out in another answer, display the error log on a page with restricted access.
Third Party Logs
Companies like PaperTrailApp make sorting through your logs very nice and easy.
Upvotes: 2
Reputation: 2252
In the Logs dir you can always view the error.log.
I usually spit out the error.log on a page that has restricted access, cause I cant always get on the filesystem and its just faster and easier for others aswell.
Upvotes: 3