Date Fri 07 September 2012

Here is a quick tip on how to make QGIS less noisy on the command line. I write quite a few command line based apps (typically in python these days) and I got kinda bored of looking at the reams of stuff that gets put onto stdout like this:

src/core/qgsproviderregistry.cpp: 219: (QgsProviderRegistry) Checking /usr/local/qgis-master//lib/qgis/plugins/libheatmapplugin.so : ..invalid (no type)
src/core/qgsproviderregistry.cpp: 219: (QgsProviderRegistry) Checking /usr/local/qgis-master//lib/qgis/plugins/libinterpolationplugin.so : ..invalid (no type)
 src/core/qgsproviderregistry.cpp: 219: (QgsProviderRegistry) Checking /usr/local/qgis-master//lib/qgis/plugins/libmemoryprovider.so : ... loaded ok (null file filters)
 src/core/qgsproviderregistry.cpp: 219: (QgsProviderRegistry) Checking /usr/local/qgis-master//lib/qgis/plugins/libmssqlprovider.so : ... loaded ok (null file filters)
 src/core/qgsproviderregistry.cpp: 219: (QgsProviderRegistry) Checking /usr/local/qgis-master//lib/qgis/plugins/libofflineeditingplugin.so : ..invalid (no type)
 src/providers/ogr/qgsogrprovider.cpp: 1579: (createFilters) Driver count: 56
 src/providers/ogr/qgsogrprovider.cpp: 1782: (createFilters) Unknown driver REC for file filters.
 src/providers/ogr/qgsogrprovider.cpp: 1782: (createFilters) Unknown driver Memory for file filters.
 etc...

You can quiet away 99% of this output using 3 environment variables:

export QGIS_DEBUG=0
export QGIS_LOG_FILE=/tmp/inasafe/realtime/logs/qgis.log
export QGIS_DEBUG_FILE=/tmp/inasafe/realtime/logs/qgis-debug.log

Of course you could also pipe the stuff out to /dev/null if you don't care to ever see it again.... Here is the total output of my command line app now after setting these environment variables:

timlinux@waterfall:~/dev/python/inasafe-realtime$ scripts/make-shakemap.sh
Processing latest shakemap
Application state:
Prefix: /usr/local/qgis-master/
Plugin Path: /usr/local/qgis-master//lib/qgis/plugins
Package Data Path: /usr/local/qgis-master//share/qgis
Active Theme Name:
Active Theme Path: ://images/themes//
Default Theme Path: ://images/themes/default/
SVG Search Paths: /usr/share/qgis/svg/
 /home/timlinux/.qgis//svg/
 /usr/local/qgis-master//share/qgis/svg/
User DB Path: /usr/local/qgis-master//share/qgis/resources/qgis.db
Creating Warped VRT.

Comments

comments powered by Disqus