1. The Friction of Magento 2 Developer Operations
During complex Magento 2 builds and enterprise upgrades, the loop between making a code change and verifying its effect in the browser is notoriously slow. You edit a XML layout file or a di.xml argument, then switch to a terminal tab, run bin/magento cache:clean config layout, wait 4 seconds for the CLI bootstrap, switch back to the browser, and refresh.
If an error occurs, you switch back to terminal, run tail -f var/log/system.log or var/log/exception.log, search for the exception trace, and repeat. Over a month of active development, a engineer will switch context between terminal and browser thousands of times.
I wanted a zero-overhead, drag-and-drop launcher bar embedded directly into the Magento Admin interface that provided instant, 1-click execution for cache flushing, per-indexer reindexing, raw log tailing, DB size monitoring, cron status inspection, and DI wiring resolution.
2. Architecture of Admin Dev Tools
The module is built under the namespace Modracx\AdminDevTools. It hooks into the Magento Admin layout via default.xml and injects a non-intrusive floating launcher bar. The floating launcher uses CSS custom variables to remember its position across page reloads via localStorage.
app/code/Modracx/AdminDevTools/
├── Controller/Adminhtml/
│ ├── Cache/ # Instant flush and selective cache type operations
│ ├── Indexer/ # Selective single-indexer execution
│ ├── Log/ # Real-time tailing and clearing of system/exception logs
│ ├── Cron/ # Schedule status and manual cron execution
│ ├── Wiring/ # Live class preference & plugin inspection
│ └── Config/ # Direct core_config_data lookup and value masking
├── Model/
│ ├── ActivityLogger.php # Audit record of admin model changes
│ ├── CacheAction.php # Fast programmatic cache flushes
│ ├── LogTail.php # Memory-safe backward file reader
│ └── WiringInspector.php # Deep DI container reflection
└── view/adminhtml/
├── layout/default.xml # Root admin layout injection
└── templates/devbar.phtml
3. High-Performance Log Tailing Without Memory Crashes
A major challenge when tailing Magento logs in PHP is that system.log or exception.log on client staging servers can grow to hundreds of megabytes. Using file_get_contents() or standard array reads will instantly exhaust PHP's memory_limit.
In Model/LogTail.php, I implemented a reverse-seeking file reader that opens the file pointer with fseek() near the end of the file and reads backwards in 4KB chunks until it extracts the requested number of log entries, using under 2MB of RAM regardless of file size.
4. Key Capabilities & Benefits
- Per-Type Cache Flushing: Selective 1-click buttons for Config, Layout, Block HTML, Full Page Cache, and Webapi without dropping unrelated caches.
- Selective Reindexing: Trigger single indexers (like
catalog_product_price) in seconds without running full reindexes. - DI Wiring Inspector: Type any class or interface name to immediately see what concrete class is injected, what preferences override it, and what plugins interpose on its methods.
- Sensitive Value Masking: Sensitive data (API keys, payment secrets) are automatically masked in log views using
ValueMasker.
5. Open Source Repository
Explore the full source code and documentation on GitHub: github.com/Modracx/admin-dev-tools.