One of the common tools available for troubleshooting issues for a website is the error log.  It is important to understand that Modx shows an error log for problems or flags that are set by developers of Modx.  Additionally, you can see an error log generated by PHP when there are problems with PHP code within the Modx CMS.  This log is not the same as the one generated by Modx.  The following article describes both types of error logs and demonstrates how you can view both types of logs within the Modx Administrator Dashboard interface.

 

Accessing the Error Logs within Modx

Understanding the Different Error Logs

Modx-generated Error logPHP Error log
File locaton The actual log file is a text file named error.log and can be found in the /core/cache/logs/ directory of your Modx installation. This is a generic error log created due to PHP errors such as syntax errors.  The error_log file can be found in multiple directories as it will be written in each directory where the error occurs.
Viewable This log is viewable through the Modx Reports>Error Log  menu option. This log is viewable through the Modx Resource Tree as a text file.
Generated when Errors in this log can be used to intentionally flag an event in Modx code for troubleshooting or development purposes. This is an automatically generated error log whose sole purpose is to log PHP errors.

 

Viewing the Modx Error Log

  1. Login to the Modx Administrator Dashboard.
  2. Hover over the menu bar where it says REPORTS.  When the drop-down menu appears, click on ERROR LOG.
  3. When the ERROR LOG screen appears, it will show the most recent errors, if there are any to report.  The screen will appear as follows:

    Error log - no errors showing

    The screenshot above shows no present errors.  If Modx errors do occur, it will display the errors written into the ERROR.LOG file.  For example, a Modx error may be shown when you improperly set a Modx tag.  If you click on the CLEAR button, the ERROR.LOG will be reset to a blank text file.

     

     

 

Viewing a PHP error log in the Modx Resource Tree

  1. Login to the Modx Administrator Dashboard.
  2. Click on the FILES tab of the Resource Tree on the left side of the screen.
  3. In order to view the ERROR_LOG file you will need to select the file by clicking on it in the files of the resource tree at left.  If a PHP error has occurred, then an ERROR_LOG file willl be written and saved in the corresponding directory where the PHP script generating the error is located.  This file can sometimes be seen in multiple locations as it is written into the location where the corresponding error occurs.  The example below shows the ERROR_LOG file in the tree-view of the files and folders at left.  In order to DELETE this log, you would need to right-click on the file in the resource tree and then select DELETE FILE from the drop-down menu that appears.
    Saved Error log

  4. Click on CLOSE in the top right-hand corner in order to close the log file.


The use of the Modx ERROR.LOG and the ERROR_LOG (generated by PHP) can be invaluable when trying to determine a problem within the Modx application.  If you have any problems with any portion of Modx, you can create a snippet to write a dummy error in the ERROR.LOG file to help determine the location of a problem in your code.  Or, you can use the recorded errors in the PHP ERROR_LOG to troubleshoot the issue and provide valuable information for your developers.

 

 

 

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}