Shotwell Architecture Overview: Logging
Shotwell logs debug messages to the console. It also uses #if’s to selectively include debug code that measures or traces the logic of important or complex code.
Starting in Shotwell 0.6, logging entries go to the file ~/.cache/shotwell/shotwell.log. (This log file may be requested by developers for more information when working through a bug, or even attached to automated bug reports). The default logging level is MESSAGE, WARNING, and CRITICAL.
To increase the log level to the maximum level (log everything), set the environment variable SHOTWELL_LOG=1 before execution. More specific types of log messages can be filtered by not setting SHOTWELL_LOG and only setting desired types, including:
These correspond to the following functions in Vala: info (), debug (), message (), warning (), and critical ().
To log to a different file, set the SHOTWELL_LOG_FILE environment variable. If it’s set to ":console:", logging will go to the console (like the old behavior).
Conditional debug code can be set by defining the appropriate #defines when compiling. These include:
MEASURE_PIPELINE: Including this adds debug code to the photo pipeline, showing the timings of various operations.
- MEASURE_ENHANCE: This adds debug and timing code to the auto-enhance feature.
TRACE_REFLOW and TRACE_REFLOW_ITEMS: The first adds trace code to CheckerboardLayout.reflow (), which places all the thumbnails on the checkerboard pages. The second adds trace code to the methods of CheckerboardItem that are executed in preparation to or during a reflow. (The first will generate a lot of debug output; the second, a tremendous amount depending on the size of your photo library.)
TRACE_PIXBUF_CACHE: This adds trace code to PixbufCache, which is the read-ahead cache used by the photo editor/viewer.
VERIFY_SORTED_LIST: This adds verification code to SortedList to ensure it’s sorting properly. This can severely slow down Shotwell.
- TRACE_DTORS: Many heavy-duty objects have trace code in their destructors to allow monitoring of when (and if!) they’re properly freed.
MONITOR_THUMBNAIL_CACHE: Dumps memory usage information about the thumbnail cache.
These #defines can be specified by using the configure script:
./configure —define=MEASURE_PIPELINE —define=MEASURE_ENHANCE