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:
export OSYNC_TRACE=/path/to/some/log/directory export SYNCML_TRACE=/path/to/some/log/directory
If you're not using syncml plugin, $SYNCML_TRACE variable has no effect.
You can exclude sensitive data by setting the OSYNC_PRIVACY environment variable:
export OSYNC_PRIVACY=1Warning: this just effects the OSYNC_TRACE-files, the SYNCML_TRACE-files will still contain sensitive data. When passing those forward, remember to remove the file(s) that contains syncml trace.
When you run some opensync command now, opensync will generated a couple of Thread*.log files like this:
~/testdir/log$ 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 *" in the log directory