Debugging best practices

Hello everyone,

I wonder what are the best debugging practices. For an example, I log exceptions with the following code:

try {

  $x = 10/0;

} catch (ErrorException $ex) {

  Yii::error($ex->getMessage(), 'xyz');


And this error will be saved in my “log” table in mySQL. However, I’m not sure what are the best practices for debugging. Can this be connected with yii2-debug extension? I’ll like to search there for errors. Also, not sure if I can query it from backend template for the whole app and how to restrict access since I don’t have the static IP address.



Debugging usually happens on local computer so I’d suggest XDebug with step by step iterations over problematic code.

OK great. Thanks for the suggesion. Just one small question:

When I try to save an error:

Yii::error($ex->getMessage(), 'xyz')

I see the following in my table:

Do you know what might be a problem?

This should be the reason of error:


No, it’s still there, but this fixed the error: