Log caught exception with stack trace

前端 未结 4 1077
逝去的感伤
逝去的感伤 2020-12-24 05:13

If I don\'t catch an exception in PHP, I get a helpful error message in my error.log file with a stack trace. For example, if I run:



        
4条回答
  •  星月不相逢
    2020-12-24 05:43

    You can use the methods from PHP's base Exception class.

    Use getMessage to get the message Oh no! and use getTraceAsString to get a formatted trace.

提交回复
热议问题