This article highlights a new MODX Extra by Sergey Shlokov. Sergey's extra delivers a neat improvement on the MODX Error Log. It's called controlErrorLog.
Error Log Annoyances
It's always bothered me that when you first want to look at the Error Log in MODX Revolution, you have to go to Manage -> Reports -> Error Log. It's easy to miss a section with the mouse and have to start over, and when you finally get to the Error Log, it may have nothing in it, or the errors may be quite stale and have nothing to do with what you're working on at the moment. .
Even worse is the condition where, without your knowledge, errors have been piling up for a long time and the Error Log is now too big to display. Being offered the option to download it isn't really very satisfying at that point.
It's also a pain to have the Error Log take you away from where you were working, especially when you have to go back and forth to it often. You can open the Error Log in a separate browser tab by right-clicking on it and selecting "Open in new Window," but that adds an extra step, and you then have to go back and forth between the browser tabs.
Enter Sergey's Plugin
The plugin is attached to one System Event: OnManagerPageBeforeRender. It puts a little icon next to your Gravatar at the upper right of the Manager's Top Menu. If the Error Log is empty, you'll see a checkmark on a white background. If the Error Log has content, you'll see an exclamation point on a yellow background. Now you can see at a glance whether the Error Log has anything to show you. The icon is not updated until you change to a new Manager Page, but at least you won't have error messages piling up over long periods of time without being warned.
Better yet, when you click on the icon — the Error Log opens in a window! No goofing around with the submenus and mouse placement. You click on the icon, you're looking at the Error Log. If you haven't changed Manager Pages since an error occurred, or are working in the front end. The errors may not show, but all you have to do is click on the "Refresh" button to see the current state of the Error Log. You also have the option to clear the log or close the window without clearing it. You can still look at the error log the old-fashioned way if you want to.
Error Log Too Big?
Another great feature of Sergey's plugin is how it handles an oversized Error Log. Rather than just telling you you're out of luck and offering to let you download the log, it will show you the ten most recent entries! The odds are that what you need to see will be there, and if not, you can still download or clear the log. If you'd like to see more than ten lines, you can change line 6 of the controlErrorLog plugin (though the value should probably be a property retrieved with
Installing Sergey's Plugin
Go to Package Management ("Extras -> Installer" in MODX 2.3+) and click on the "Download Extras" button. That will take you to the MODX repo where you can enter
controlErrorLog in the search box and press Enter. Click on the "Download" button next to controlErrorLog. When the download is finished, click on the "Back to Package Management" button.
You should see the package in the grid. Click on its "Install" button. The plugin will be enabled on installation and you should see the icon at the upper right as soon as you reload the Manager page.
As I said above, the status of the Error Log with the plugin is not always up to date. It depends on what you've been doing. If all your work is in the front end and you haven't changed views in the Manager, you'll need to click on the icon and on the "Refresh" button to see the current state. It's a slight inconvenience, but so much better than having to navigate to the Error Log the old way.
If there are new errors in a previously empty Error Log. You'll see the yellow exclamation point as soon as you change locations in the Manager. No more having error messages pile up for days or weeks without your knowing about them.