How to replay the di log file using the “trace” option of the CDI.
CDI can run in ‘trace mode’, which takes a ‘di’ log filefrom a
previous run as its only input, and will run readingserver messages
and Asterisk packets from the log file and will produce anew log file
essentially identical to the input log file.It is very useful when
trying to figure out why cdi did something bad, like geta corefault
or a weird error message or any other kind of error.The idea is, run
cdi again with the log file and with additional loggingturned on, or
run it from the debugger and put a breakpoint at the spotwhere things
go astray.
It can also be useful to add additional logging or othercode to the
cdi source, and then recompile and run with the logfilefrom the
problem run to get a detailed information about what wentwrong.
If the version of cdi is the same as the one whichproduced the
logfile, the new logfile will be very nearly identical tothe original
except timing in seconds might be off by a second becausethe second
rolls over to the next second at a slightly differentpoint in the
run.Aside fromthat, any differences betweenthe logfile before and
the logfile after should be examined and understood.
If the cdi version is different from the one whichproduced the
original logfile, it might still run just fine but thelogfiles might
differ.However,even if they are not the same, the logfile lines
beginning with “ZZ” (connects) or”ERROR” (errors) should match
exactly.
If the cdi version is very different than the one whichmade the
original file, the trace mode run might not run to theend.
To make cdi produce different logging than the originalrun, find the
last logfile line which begins “LOGGING” andadd or remove logging
classes from it.The must obvious of this is to add “DBG” to the
logging and the trace run will reproduce the original logfile with
all the debugging logging added to it.It can also be useful to add
logging to cdi in class “NEW”, for example, andthen add “NEW” to the
logging line in the original logfile.
Running cdi in trace mode, you must have a logfile (or aset of
contiguous log files) which begins with “LOG#1”, the logfile with the
“initial start-up”.If you are running through more than onelogfile,
they must be sequential.The timestamp at the end of one will be
the same as the timestamp at the beginning of the nextone or very
rarely it will be one second earlier.
For doing tricky timing analysis, you can also addmillisecond or
microsecond resolution to the logfile produced in thetrace run by
setting the appropriate dump switches in the initialfile.Running in
trace mode, cdi should set the dump bits according to thelogging
lines “DUMPBITS” but right now it doesn’t; ituses whatever dump
switches are set in the initial file or files it picks upthe same as
any program.
To run cdi in trace mode, say :
“cdi <logfile>[<logfile>] [<logfile>] trace”