But, what is a stack trace? In essence, it is a rundown of every file and function that is called leading up to the error. Whenever exceptions are thrown, a stack trace is usually included. Jump back to Step 3, adjust your test parameters, and try it all over again. Not every error is easy to reproduce, and may have time-based constraints or something else making it difficult to replicate in a non-production environment. If you were unable to replicate the problem in Step 4, then it's back to the drawing board. Step 5: Adjust test parameters and try again Development and staging environments are designed to be breakable without any impact on the end-users, so always always always try to break your code in a safe environment. Once you've established the circumstances that you think might throw the exception or error you are hunting down, it's time to test them. This involves doing things like mimicking the production database, the user accounts involved, and even the operating system. Before we can do this, we first need to establish some testing guidelines. Once you've determined the log lines that relate to the problem at hand, the next step is to attempt to replicate the circumstances of the error in a development environment. Step 3: Attempt to replicate circumstances This can be done through any number of log aggregation platforms, and allows you to start establishing a timeline of events without worrying about the log files being rolled over. Once you've increased the log level, the next step is to start retaining logs. There is a good chance that the problems you are experiencing have warnings or messages associated with them that don't necessarily make it into the log files by default. This allows you to see everything that is happening before and after a problem occurs. Using the methods described in Where are PHP Errors Logged?, the first step towards diagnosing any issue is to increase the log level. Debugging PHP Errors Step 1: Increase the log level That said, there are a few common steps that can be followed towards identifying and resolving errors that crop up in production. More often than not, the error reports are vague, and identifying the underlying causes can be difficult at best. Debugging PHP errors in a production environment can be one of the single most frustrating experiences as a developer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |