doc/book/en/annexes/rql/debugging.rst
changeset 10491 c67bcee93248
parent 10490 76ab3c71aff2
child 10492 68c13e0c0fc5
equal deleted inserted replaced
10490:76ab3c71aff2 10491:c67bcee93248
     1 .. -*- coding: utf-8 -*-
       
     2 
       
     3 .. _DEBUGGING:
       
     4 
       
     5 Debugging RQL
       
     6 -------------
       
     7 
       
     8 Available levels
       
     9 ~~~~~~~~~~~~~~~~
       
    10 
       
    11 Server debugging flags. They may be combined using binary operators.
       
    12 
       
    13 .. autodata:: cubicweb.server.DBG_NONE
       
    14 .. autodata:: cubicweb.server.DBG_RQL
       
    15 .. autodata:: cubicweb.server.DBG_SQL
       
    16 .. autodata:: cubicweb.server.DBG_REPO
       
    17 .. autodata:: cubicweb.server.DBG_MS
       
    18 .. autodata:: cubicweb.server.DBG_HOOKS
       
    19 .. autodata:: cubicweb.server.DBG_OPS
       
    20 .. autodata:: cubicweb.server.DBG_MORE
       
    21 .. autodata:: cubicweb.server.DBG_ALL
       
    22 
       
    23 
       
    24 Enable verbose output
       
    25 ~~~~~~~~~~~~~~~~~~~~~
       
    26 
       
    27 To debug your RQL statements, it can be useful to enable a verbose output:
       
    28 
       
    29 .. sourcecode:: python
       
    30 
       
    31     from cubicweb import server
       
    32     server.set_debug(server.DBG_RQL|server.DBG_SQL|server.DBG_ALL)
       
    33 
       
    34 .. autofunction:: cubicweb.server.set_debug
       
    35 
       
    36 Another example showing how to debug hooks at a specific code site:
       
    37 
       
    38 .. sourcecode:: python
       
    39 
       
    40     from cubicweb.server import debugged, DBG_HOOKS
       
    41     with debugged(DBG_HOOKS):
       
    42         person.cw_set(works_for=company)
       
    43 
       
    44 
       
    45 Detect largest RQL queries
       
    46 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
    47 
       
    48 See `Profiling and performance` chapter (see :ref:`PROFILING`).
       
    49 
       
    50 
       
    51 API
       
    52 ~~~
       
    53 
       
    54 .. autoclass:: cubicweb.server.debugged
       
    55