Debug the SQL Query of a Live Data
Last modified by Eleni Cojocariu on 2026/09/25 02:48
Steps
Read the SQL query a Live Data built on the liveTable source actually ran, when it returns the wrong entries, with edit right on XWiki.LiveTableResultsMacros and access to the "Logging" administration section.
- Open the browser developer tools on the page holding the Live Data, select the "Network" tab and filter on /entries to find the URL it fetches its entries from.
- Open that URL in a new tab, with &sourceParams.sql=1 appended to its query string.
- Edit XWiki.LiveTableResultsMacros, find request.sql and add these two lines next to it:
#set ($discard = $services.logging.getLogger('XWiki.LiveTableResultsMacros').debug("SQL: $sql")) #set ($discard = $services.logging.getLogger('XWiki.LiveTableResultsMacros').debug("SQL parameters: $sqlParams")) - Open the "Logging" administration section, search for the XWiki.LiveTableResultsMacros logger and set its level to debug.
- Reload the entries URL. The server logs then hold the query and its parameters:
DEBUG X.LiveTableResultsMacros - SQL: where 1=1 order by lower(doc.fullName) asc, doc.fullName asc DEBUG X.LiveTableResultsMacros - SQL parameters: {} - Remove the two lines from XWiki.LiveTableResultsMacros and reset the logger level.
FAQ
Why can I not just add sql=1 as I would with a live table?
Because the parameter reaches the results page, but the Live Data does not display the extra field it adds to the JSON response.
Nothing is written to the logs. What did I miss?
Most likely the logger level, which has to be set to debug on the XWiki.LiveTableResultsMacros logger.