<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Jun 12, 2017 at 12:40 AM Marc-André Lureau <<a href="mailto:marcandre.lureau@gmail.com">marcandre.lureau@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi<br><div><br><div class="gmail_quote"></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div dir="ltr">On Fri, Jun 9, 2017 at 10:08 PM Jonathon Jongsma <<a href="mailto:jjongsma@redhat.com" target="_blank">jjongsma@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, 2017-06-09 at 12:11 -0400, Marc-André Lureau wrote:<br>
> ><br>
><br>
> ----- Original Message -----<br>
> ><br>
> > > On 9 Jun 2017, at 17:16, Jonathon Jongsma <<a href="mailto:jjongsma@redhat.com" target="_blank">jjongsma@redhat.com</a>><br>
> > > wrote:<br>
> > ><br>
> > > On Fri, 2017-06-09 at 10:59 +0200, Christophe de Dinechin wrote:<br>
> > > > > > What I see on the thread:<br>
> > > > > > - log categorization. This was similar to Djasa bug but I<br>
> > > > > > think<br>
> > > > > > he just<br>
> > > > > >   proposed to use domains in the glib log sense;<br>
> > > ><br>
> > > > Punchcard analogy: “Printer sheet categorization. This was<br>
> > > > similar to<br>
> > > > the report that Djisktra had taken McCarthy's listing by<br>
> > > > mistake"<br>
> > > ><br>
> > > > I thought it was a good idea to derive glib log domains<br>
> > > > automatically<br>
> > > > from spice-traces.def. So it’s there in the branch now. That<br>
> > > > being<br>
> > > > said, as noted above, glib does linear searches on domain<br>
> > > > names, so<br>
> > > > this does not scale well. In the long term, we may want to have<br>
> > > > a<br>
> > > > separate field in a structured log.<br>
> > ><br>
> > ><br>
> > > Responding only to this point for the moment: I don't think using<br>
> > > multiple glib logging domains is necessarily desirable. We<br>
> > > already use<br>
> > > several logging domains, but the vast majority of logging<br>
> > > statements<br>
> > > within each project use a single domain. In spice-server, that<br>
> > > primary<br>
> > > log domain is "Spice", and in spice-gtk that domain is "GSpice".<br>
> > > spice-<br>
> > > server also has some additional domains like "SpiceWorker" and<br>
> > > "SpiceDispatcher". spice-gtk also has GSpiceController (which<br>
> > > isn't<br>
> > > really used much these days).<br>
> > ><br>
> > > The problem is that both spice-server and spice-gtk have a way to<br>
> > > enable debugging with an environment variable. But the code for<br>
> > > enabling the debugging only actually enables the primary domain.<br>
> ><br>
> > The ‘traces’ branch enables all trace-related domains if you enable<br>
> > debug.<br>
> ><br>
> > > So anything that is logged under a different domain does not get<br>
> > > enabled.<br>
> > > (In fact, spice-gtk has 2 ways to enable logging with an<br>
> > > environment<br>
> > > variable but one of the methods is the same one used for spice-<br>
> > > server,<br>
> > > but it doesn't work since it actually enables logging for the<br>
> > > "Spice"<br>
> > > domain which spice-gtk doesn't use.) I'm hoping to send some<br>
> > > patches to<br>
> > > clean up this mess soon.<br>
> ><br>
> > Ah, so I was not the only one thinking this was a mess :-)<br>
><br>
> The mess comes because spice-gtk and spice server used different<br>
> logging, when spice didn't depend on glib.<br>
><br>
> The cleanup isn't over I suppose (Christophe F. did the move to glog<br>
> in spice-common). <br>
><br>
> I don't get the problem with spice-gtk logging though.<br>
><br>
<br>
<br>
Yes, there are historical reasons. And "mess" was an exaggeration. But<br>
in the process of consolidating the implementations, we seem to have<br>
introduced some inconsistencies. I'll send more details soon, I hope.<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div><div class="gmail_quote"><div>Some of them I just found out by reading spice-common log.c, introduced when switching to glog:<br><br>            debug_env = (char *)g_getenv("G_MESSAGES_DEBUG");<br>            if (debug_env == NULL) {<br>                g_setenv("G_MESSAGES_DEBUG", SPICE_LOG_DOMAIN, FALSE);<br>            } else {<br>                debug_env = g_strconcat(debug_env, ":", SPICE_LOG_DOMAIN, NULL);<br>                g_setenv("G_MESSAGES_DEBUG", SPICE_LOG_DOMAIN, FALSE);<br>                g_free(debug_env);<br>            }<br><br></div><div>- appending to G_MESSAGES_DEBUG is buggy, it's not using the newly built debug_env.<br></div><div>- this will only append the default "Spice" SPICE_LOG_DOMAIN (not the other spice sub-domains), <br></div><div>- the variable expects a space-seperated list (you sent a patch for that)<br></div><div>(+ the unnecessary cast, could just use another variable...)<br></div></div></div></div></blockquote><div><br>+  it doesn't overwrite the value! :)<br><br></div></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Marc-André Lureau<br></div></div>