Re: [OpenSIPStack] Problems with Ptrace
Brought to you by:
joegenbaclor
From: Ilian J. C. P. <ip...@so...> - 2008-01-09 10:11:02
|
Hi, First of all... You are calling hello->digaoi() before initializing PTrace. Naturally, no logging was done in hello. void Oi::Main() { Hello * hello = new Hello(); hello->digaoi(); // ********* Move this below... char * filename = "C:\\Documents and Settings\\voip\\Desktop\\ttt\\src\\buda3.txt" ; //cout << "Test"; PTrace::Initialise(32, filename, PTrace::Blocks | PTrace::Timestamp | PTrace::Thread |PTrace::FileAndLine); PTRACE(1,"Inside oi.cpp \n"); } Alternatively, you can use this for logging... ** Oi.h #include <ptlib.h> #include <Logger.h> class Oi : public PProcess, public Tools::Logger { PCLASSINFO(Oi, PProcess) public: void Main(); }; ** Oi.cpp #include "Oi.h" #include "Hello.h" PCREATE_PROCESS(Oi) using namespace Tools; void Oi::Main() { Hello* hello = new Hello(); // PTrace::Initialise(32, "C:\\buda3.txt", PTrace::Blocks | PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine); PTrace::SetLevel( 3 ); // The level just means print PTRACE(1, ..) to PTRACE(3, ..) Logger::SetDefaultLogStream( new Tools::LoggingFileStream( "C:\\buda3.txt" ) ); hello->digaoi(); PTRACE(1, "Inside oi.cpp \n"); delete hello; } Now you should be able get logs from both PTRACE and LOG macros. - Ilian Claudio Miceli wrote: > Hello, > > I was working in a softphone and during my work I discovered that my log > file was not being created. > Since I was using Ptrace I found that it was really weird. Actually my > program creates a log file, but the log sees only the PTRACE's in the main > file. I can not use Ptrace in files that are not my main file. > > I tried to put "# define PTRACING 1" in my other files, but it did not work > as well. > > The following example does not work : > > hello.cpp > > #include <iostream> > #include <ptlib.h> > using namespace std; > class Hello > { > > public: > void digaoi(){ > PTRACE(1,"Inside hello \n"); > > cout << "Hello world!\n"; > } > > }; > > oi.cpp - main file > > > #define PTRACING 1 > > #include <ptlib.h> > //#include <iostream> > > #include "C:\Documents and Settings\voip\My Documents\hello.cpp" > > > class Oi : public PProcess > { > PCLASSINFO(Oi, PProcess) > public: > void Main(); > }; > > PCREATE_PROCESS(Oi) > > void Oi::Main() > { > Hello * hello = new Hello(); > > hello->digaoi(); > > char * filename = "C:\\Documents and > Settings\\voip\\Desktop\\ttt\\src\\buda3.txt" ; > > //cout << "Test"; > > PTrace::Initialise(32, filename, PTrace::Blocks | PTrace::Timestamp | > PTrace::Thread |PTrace::FileAndLine); > > PTRACE(1,"Inside oi.cpp \n"); > > } > > > Do you have any sugestion, or even a clue ? > > Thanks in advance. > > Claudio Miceli de Farias > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > opensipstack-devel mailing list > ope...@li... > https://lists.sourceforge.net/lists/listinfo/opensipstack-devel > > > |