Guide to Tracing
OpenSync has support for tracing the application calls that can be very helpfull to find and fix a problem quickly.
Note for Gentoo users: You need to build libopensync with debug useflag enabled.
The first thing you should do is to turn on tracing by setting the environment variable:
mkdir /var/tmp/os export OSYNC_TRACE=/var/tmp/os export SYNCML_TRACE=/var/tmp/os
If you're not using syncml plugin, $SYNCML_TRACE variable has no effect.
You can include sensitive data by setting the OSYNC_NOPRIVACY environment variable:
export OSYNC_NOPRIVACY=1
When you run some opensync command now, opensync will generated a couple of Thread*.log files like this:
/var/tmp/os% ls Thread1076193760.log Thread1076260000.log Thread1104583600.log Thread1113836464.log Thread1130621872.log
Each of these files corresponds to one thread in opensync (we have to use a separate file for each thread so that the threads do not step on each others toes while accessing the files and to maintain readability)
Inside each file you will find a call hierachy with a timestamp like this:
[1113061111.389599] >>>>>>> osengine_new(0x804f318, 0xbffff598) [1113061111.389699] [CLI] DEBUG: Creating new client 0x805c238 [1113061111.389745] [CLI] DEBUG: Creating new client 0x805ec28 [1113061111.389781] >>>>>>> osengine_mappingtable_new(0x805de98) [1113061111.389807] osengine_mappingview_new(0x805ed68) [1113061111.389828] osengine_mappingview_new(0x805f170) [1113061111.389848] <<<<<<< osengine_mappingtable_new: 0x805f118 [1113061111.389868] <<<<<<< osengine_new: 0x805de98
This means that someone called osengine_new (notice that all call parameters are listed) which then called osengine_mappingtable_new.
if there was an error in a function it will be labeled like this:
[1113059956.276641] >>>>>>> osync_member_read_config(0x804e1b0, 0xbffff854, 0xbffff858, 0xbffff8f8) [1113059956.276689] [OSYNC] DEBUG: Unable to read file /tmp/plgtest.4HeEbc/evo2-sync.conf: No such file or directory [1113059956.276714] <--- ERROR --- osync_member_read_config: Unable to open file /tmp/plgtest.4HeEbc/evo2-sync.conf for reading: No such file or directory
So you can quickly search for errors by doing grep ERROR * or less * in the log directory. In less, letters n moves to next file, p to previous, /ERR searches string ERR.
