Changes

Jump to: navigation, search

Logging system

331 bytes added, 23:46, 11 May 2020
m
If debugging is enabled
The Gramps Logging System is based on [httphttps://docs.python.org/liblibrary/module-logging.html Python]s logging facility.
==Handler subclasses==
The RotateHandler, GtkHandler and StreamHandler are all instantiated in <tt>gramps.py</tt> (setup_logging), while Warnhandler is instantiated in <tt>DisplayState.py</tt> (DisplayState.__init__). Rotatehandler is attached also to GtkHandler for the purpose described in GtkHandler description. Each Handler instance has a custom formatter assigned.
{| {{prettytable}}class="wikitable sortable"
|+Handler instance parameters
|-
The usage of the switch is quite simple:
python grampsGramps.py -d "name_of_the_logger"
or:
python grampsGramps.py --debug="name_of_the_logger"
The name of the root logger is an empty string, thus e.g. <tt>--debug=""</tt> will enable all debug logs.
<blockquote>'''{{man warn|Note!''' |The argument of the switch is <u>not</u> optional.</blockquote>}}
==So how logging works in Gramps after all?==
python src/gramps.py -d '.pageview'
:Strings need to be double-quoted on Windows, this is the Windows equivalent of the above command (with the "all in one installer" executed from "C:\Program Files\GrampsAIO64-5.1.2"):
 
grampsw.exe -d ".pageview"
 
:On Windows the log output goes into the file "%AppData%\gramps\Gramps51.log" (which is cleared every time the app restarts).
[[Category:Developers/Reference]]
[[Category:Developers/Tutorials]]
[[Category:Developers/General]]
14
edits

Navigation menu