Wiki source code of Debug the SQL Query of a Live Data
Last modified by superadmin on 2026/11/25 21:39
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
![]() |
4.1 | 1 | This needs a Live Data built on the ##liveTable## [[source>>doc:documentation.xs.user.livedata.display-data.sources.WebHome]], edit right on ##XWiki.LiveTableResultsMacros## and access to the "Logging" administration section. |
![]() |
1.1 | 2 | 1. 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. |
| 3 | 1. Open that URL in a new tab, with ##&sourceParams.sql=1## appended to its query string. | ||
| 4 | 1. Edit ##XWiki.LiveTableResultsMacros##, find ##request.sql## and add these two lines next to it:((( | ||
| 5 | {{code language="velocity"}} | ||
| 6 | #set ($discard = $services.logging.getLogger('XWiki.LiveTableResultsMacros').debug("SQL: $sql")) | ||
| 7 | #set ($discard = $services.logging.getLogger('XWiki.LiveTableResultsMacros').debug("SQL parameters: $sqlParams")) | ||
| 8 | {{/code}} | ||
| 9 | ))) | ||
| 10 | 1. Open the "Logging" administration section, search for the ##XWiki.LiveTableResultsMacros## logger and set its level to ##debug##. | ||
| 11 | 1. Reload the entries URL. The server logs then hold the query and its parameters:((( | ||
| 12 | {{code language="none"}} | ||
| 13 | DEBUG X.LiveTableResultsMacros - SQL: where 1=1 order by lower(doc.fullName) asc, doc.fullName asc | ||
| 14 | DEBUG X.LiveTableResultsMacros - SQL parameters: {} | ||
| 15 | {{/code}} | ||
| 16 | ))) | ||
| 17 | 1. Remove the two lines from ##XWiki.LiveTableResultsMacros## and reset the logger level. | ||
| 18 |

