Introducing our latest open source module: The Verbose Log Request

21/11/2022

The Ampersand_VerboseLogRequest module is our latest open source module to be released, helping you debug issues that are reproducible on production but hard to replicate on other environments. 

 

This module allows you to dynamically change the log level per request(s) to DEBUG during runtime by passing in a valid X-Verbose-Log header. This enables database query, cache IO, and DEBUG logging for the request that is causing the error. All other requests will continue to be logged in the standard INFO level, allowing you to debug critical issues with greater speed and efficiency. 

 

So, what does this mean?  

Simply put, you can get verbose information when you are debugging something on production without having to switch on these settings globally. This has numerous benefits: 

1. Performance: Logging the verbose data for every process would slow the system down, by homing in on your own requests the system behaves as normal for all other requests and processes. 

2. Storage: The volume of data being logged would easily fill up disk space if it were enabled for every process, by limiting it to only yours, the volume of data is much more manageable. 

3. Usability: Logging data for every process would make it practically impossible to identify which logs belonged to your problem request, limiting these log writes to your defined requests leaves you with a much smaller pool of data to navigate.  . This problem is further solved by installing Ampersand_LogCorrelationId to link logs with their requests.

 

How can you use it?  

Here are just a few ways this module can be used: 

– A third-party module you have installed is not working properly when communicating with their API. You can see they have error logging in the code but it is at `$logger->debug()` level which is not enabled on production so the error is not logged. Using this module we can repeat this process and access that granular log data without having to reconfigure the whole application. 

– A certain combination of products and shipping methods breaks the checkout process on production. By using this module you would be able to see the specific database queries (and their stack traces) that trigger while attempting to proceed through the checkout. This will allow you to navigate directly in on the faulty shipping rate/product configuration within the database. 

– Some data on the product page doesn’t always update correctly as it is saved within the admin panel. Using this module you can see all the cache read/writes responsible for that page, and identify the source of this stale data. 

 

To start using the module please visit 

https://github.com/AmpersandHQ/magento2-verbose-log-request