You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2003/09/18 13:17:10 UTC

cvs commit: xml-axis/c/src/common AxisTrace.h AxisTrace.cpp

damitha     2003/09/18 04:17:10

  Modified:    c/src/common AxisTrace.h AxisTrace.cpp
  Log:
  Added code so that the path to AxisLog can be read from a file.
  
  Revision  Changes    Path
  1.3       +9 -10     xml-axis/c/src/common/AxisTrace.h
  
  Index: AxisTrace.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/AxisTrace.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AxisTrace.h	17 Sep 2003 05:54:38 -0000	1.2
  +++ AxisTrace.h	18 Sep 2003 11:17:10 -0000	1.3
  @@ -67,13 +67,7 @@
   #include <string>
   #include <stdio.h>
   
  -#ifdef WIN32
  -    #define TRACE_PATH "E:\\Program Files\\Apache Group\\Apache\\Axis\\logs\\AxisLog";
  -#else //linux
  -    #define TRACE_PATH "/usr/local/apache/Axis/logs/AxisLog";
  -#endif
  -
  -#define AXISTRACE
  +//#define AXISTRACE
   #if defined(AXISTRACE)
     #define AXISTRACE1(X) tracer.trace(X,__FILE__,__LINE__);
     #define AXISTRACE2(X,Y) tracer.trace(X,Y,__FILE__,__LINE__);
  @@ -85,6 +79,9 @@
   
   //extern unsigned char chEBuf[1024];
   using namespace std;
  +/**
  +This is class is used to log messages when AXISTRACE is defined.
  +*/
   class AxisTrace
   {
   public:
  @@ -92,14 +89,16 @@
   	virtual ~AxisTrace();
       int trace(const char* sLog, char* arg2, int arg3);
       int trace(const char* sLog1, const char* sLog2, char* arg3, int arg4);
  +    int GetConfPath();
     
   private:
       char strLine[4];
  -    char* sFileName;
  -    FILE* fileTrace;  
  +    char sFileName[200];
  +    FILE* fileTrace;
  +    const FILE* ConfFile; 
   
   };
   
   static AxisTrace tracer;
   
  -#endif
  \ No newline at end of file
  +#endif
  
  
  
  1.3       +29 -1     xml-axis/c/src/common/AxisTrace.cpp
  
  Index: AxisTrace.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/common/AxisTrace.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AxisTrace.cpp	17 Sep 2003 05:54:38 -0000	1.2
  +++ AxisTrace.cpp	18 Sep 2003 11:17:10 -0000	1.3
  @@ -61,13 +61,15 @@
   
   #include "AxisTrace.h"
   #include <time.h>
  +#include "AxisUtils.h"
  +#include "GDefine.h"
   
   using namespace std;
   
   
   AxisTrace::AxisTrace()
   {
  -  sFileName = TRACE_PATH;
  +    GetConfPath();
   }
   
   AxisTrace::~AxisTrace()
  @@ -142,6 +144,32 @@
   
           return SUCCESS;
       }
  +}
  +
  +int AxisTrace::GetConfPath()
  +{
  +    int key;
  +    int intItr = 0;
  +    if ((ConfFile = fopen(CONFFILENAME, "r")) == NULL)
  +        return FAIL;
  +    else
  +    {
  +        //fgets(str,200,ConfFile);
  +        while (!feof(ConfFile))
  +        {
  +            key = fgetc(ConfFile);
  +            /* The last character read is the end of file marker */
  +            /* so don't print it                                 */
  +            if (!feof(ConfFile))
  +            {
  +                sFileName[intItr] = key;
  +                intItr++;
  +            }
  +        }
  +        sFileName[intItr] = '\0';
  +    }
  +    fclose(ConfFile);
  +    return SUCCESS;
   }
   
   /*