[Spice-devel] [PATCH spice-xpi 3/4] Switch from log4cpp to glib

Marc-André Lureau marcandre.lureau at gmail.com
Fri Feb 24 03:18:59 PST 2012


Hi

On Fri, Feb 24, 2012 at 12:10 PM, Alon Levy <alevy at redhat.com> wrote:
>
> I was with you until you suggested to use ldpreload. Is there an actual
> easy way to do this to redirect error messages somewhere?

ldpreload can be useful if you want to override and use your own g_log
handler for debugging. I don't mean it should be used as a solution,
in production..

You can redirect with normal redirection > | etc.. I use logger to
redirect to syslog in the spice-xpi-client scripts for example.

> So how would we make sure there is a log file for SpiceXPI?

Tbh, I think there should be *no* log file, and it should use standard
methods instead. stderr is redirected to .xsession-errors normally,
but you should try to reproduce an issue by setting
G_MESSAGES_DEBUG=SpiceXPI (and other domain), starting firefox and
redirecting output to a file.


>>      if (NPN_InvokeDefault(m_instance, call_on_disconnected, args, sizeof(args) / sizeof(args[0]), &void_result))
>> -    {
>> -        LOG_DEBUG("OnDisconnected successfuly called");
>> -    }
>> +        g_debug("OnDisconnected successfuly called");
>
> Why are you dropping the scope?

Just saving 4 empty lines. I thought about rewriting it to one line
without condition too, ex:

g_debug("OnDisconnected: ", err != 0 ? "success" : "failed");

-- 
Marc-André Lureau


More information about the Spice-devel mailing list