dbus: how to see traces from different processes

John (J5) Palmieri johnp at redhat.com
Mon Apr 23 06:24:41 PDT 2007


On Mon, 2007-04-23 at 14:12 +0200, Matthieu LAURENT wrote:
> 
> > > Hi,
> > > I am new in using dBus. I have installed an application that use dbus
> > > and launch several processes.
> > > New I launch the client I see its traces (fprintf(stderr), or g_print)
> > > but I can not see the other traces of the processes that are going to be
> > > launched.
> > > If I launch this process before my application I see its traces in the
> > > console where I launched it.
> > > Is there a way to redirect traces in order to have all of them in the
> > > same console?
> > > Is it compulsory to launch processes before the application? (in my case
> > > it is annoying because a process will launch several other processes)
> > > 
> > >     
> > 
> > Launch the processes before hand.  D-Bus activation is just there to
> > start a process if it isn't already started.  Otherwise the process
> > should act exactly the same.  The other option is to redirect stdio and
> > stderr to a file in the app that is being launched.
> 
> Hi,
> As I told you, I can not launch all processes before because some of
> them are launched by other processes.
> It seems my only solution is to redirect traces into a file (Am I
> right?).
> The system of traces, of the code I want to use, is  based on
> g_debug(), g_warning() 
> Is there a simple way to redirect the output of such functions?
> (I mean a better way to rebuild file gmessage.c of the glib where I
> should hardcode a file-descriptor in function g_log_default_handler()
> instead of stdout)

You can use g_log_set_default_handler or g_log_set_handler in all the
applications you want to log to a file.  There may also be a way in glib
to tell the default handler to log everything to a file by simply
setting an environment variable but that you would have to ask someone
else about.

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list