[Spice-devel] RFC: Lightweight tracing mechanism

Marc-André Lureau marcandre.lureau at redhat.com
Mon Jun 12 12:31:04 UTC 2017


Hi

----- Original Message -----
> On Fri, Jun 09, 2017 at 12:11:50PM -0400, Marc-André Lureau wrote:
> > I don't get the problem with spice-gtk logging though.
> 
> I never remember whether G_MESSAGES_DEBUG=all, SPICE_DEBUG=1 and
> --spice-debug are the same or not, I think they are not, and if you only
> use eg G_MESSAGES_DEBUG=all, you don't get all possible debug, which I
> would expect.
> Maybe this was introduced when switching to glog.

Historically, from what I remember in spice-gtk:

- SPICE_DEBUG=1 has "always" (since 0.1) been there to enable spice-gtk debugging with glog
- --spice-debug was added when GOptionGroup was added, as a convenience. It should have the same effect as SPICE_DEBUG=1. Last call to spice_util_set_debug() should win, so --spice-debug overrides SPICE_DEBUG=1.
- then G_MESSAGES_DEBUG happened, and spice-gtk learned to add its GSpice domain there (but not the controller, which is a seperate, mostly deprecated now, library)

spice-common/server log has also an history:

- it used to have mostly unconfigurable log in stderr
- then SPICE_DEBUG_LEVEL= was added in 2011
- default abort() behaviour was problematic, I added SPICE_ABORT_LEVEL, so it could be tweaked (similar to glib fatal-warnings, fatal-criticals etc)
- at that time, I tried to move to a very similar API to glog, in the hope that some day we could easily switch over
- then glib logging was added end of 2015 by Christophe F., where we started to deprecate SPICE_{DEBUG,ABORT}_LEVEL, but didn't switch to direct glog usage though for compatibility reasons. G_MESSAGES_DEBUG is partially wrong, as described earlier, which contributes to some confusion
- Christophe D. suggests to add categories and more tweaking options through a new SPICE_TRACES variable
- I suggest to remove SPICE_DEBUG_LEVEL/SPICE_ABORT_LEVEL and switch more to direct glog, and add categories tweakable with SPICE_DEBUG

G_MESSAGES_DEBUG & G_DEBUG will remain no matter what. I would like to keep SPICE_DEBUG=1 to enable all SpiceGtk logging as it has proven to be very convenient over the years. I suggest to get rid of SPICE_*_LEVEL, and extend SPICE_DEBUG= with categories filtering only, and used structured logging to ease query and log manipulation. I would liek to further run-time "tweaking" to be considered a case-by-case and apart from log category selection.


More information about the Spice-devel mailing list