axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject cvs commit: ws-axis/c/src/common AxisTrace.cpp
Date Tue, 27 Apr 2004 03:50:35 GMT
damitha     2004/04/26 20:50:34

  Modified:    c/include/axis/server AxisTrace.h
               c/src/common AxisTrace.cpp
  Log:
  axis log facility is provided for trace values long and double
  for example developer can now enter a log message as following
  AXISTRACE2 ("this is a test", (long) 3, INFO);
  
  Revision  Changes    Path
  1.8       +89 -21    ws-axis/c/include/axis/server/AxisTrace.h
  
  Index: AxisTrace.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/server/AxisTrace.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AxisTrace.h	26 Apr 2004 04:05:13 -0000	1.7
  +++ AxisTrace.h	27 Apr 2004 03:50:34 -0000	1.8
  @@ -1,22 +1,63 @@
   /*
  - *   Copyright 2003-2004 The Apache Software Foundation.
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 2002 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution,
  + *    if any, must include the following acknowledgment:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself,
  + *    if and wherever such third-party acknowledgments normally appear.
  + *
  + * 4. The names "SOAP" and "Apache Software Foundation" must
  + *    not be used to endorse or promote products derived from this
  + *    software without prior written permission. For written
  + *    permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache",
  + *    nor may "Apache" appear in their name, without prior written
  + *    permission of the Apache Software Foundation.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + *
    *
  - *   Licensed under the Apache License, Version 2.0 (the "License");
  - *   you may not use this file except in compliance with the License.
  - *   You may obtain a copy of the License at
  - *
  - *       http://www.apache.org/licenses/LICENSE-2.0
  - *
  - *   Unless required by applicable law or agreed to in writing, software
  - *   distributed under the License is distributed on an "AS IS" BASIS,
  - *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - *   See the License for the specific language governing permissions and
  - *   limitations under the License.
    */
    
   
  -#ifndef __AXISLOG_H_OF_AXIS_INCLUDED_
  -#define __AXISLOG_H_OF_AXIS_INCLUDED_
  +#ifndef __AXISLOG_H_INCLUDED_
  +#define __AXISLOG_H_INCLUDED_
   
   #include "GDefine.h"
   #include <list>
  @@ -26,7 +67,7 @@
   #define __AXISTRACE__
   #if defined(__AXISTRACE__)  
     #define AXISTRACE1(X, Y) g_pAT->logaxis(X,Y,__FILE__,__LINE__);
  -  #define AXISTRACE2(X,Y, Z) g_pAT->logaxis(X,Y,Z,__FILE__,__LINE__);
  +  #define AXISTRACE2(X, Y, Z) g_pAT->logaxis(X,Y,Z,__FILE__,__LINE__);
     #define AXISTRACE3(X) g_pAT->trace(X);
     
   #endif
  @@ -53,6 +94,7 @@
   public:
       AxisTrace();
   	virtual ~AxisTrace();
  +    int logthis(const char* sLog, int level, char* arg2, int arg3);
       /**
   	 * This is called in writing to the log file whose path is specified in $AXIS_HOME/axiscpp.conf
file.
        * This method is used when the caller has only one string message as argument. User
  @@ -66,18 +108,44 @@
   	 */
       int logaxis(const char* sLog, int level, char* arg2, int arg3);
       /**
  -	 * This is called in writing to the log file whose path is specified in $AXIS_HOME/axiscpp.conf
file.
  -     * This method is used when the caller has two string messages as arguments. One may
be his own message.
  -     * The other may be to print a trace value. User can also specify the severity of the
message by
  +     * This is called in writing to the log file whose path is specified in $AXIS_HOME/axiscpp.c
    * onf file.
  +     * This method is used when the caller has two string messages as arguments. One may
be his      *own message.
  +     * The other may be to print a trace value. User can also specify the severity of the
messag     *e by
        * assigning level argument to one of CRITICAL, WARN, INFO or TRIVIAL.
  -	 * @param sLog1 string message one
  +     * @param sLog1 string message one
        * @param sLog2 string message two  
        * @param level severity level
        * @param arg3 file name
        * @param arg4 line number
  -	 * @return The status which indicates whether the operation is success (AXIS_SUCCESS)
or not (AXIS_FAIL).
  -	 */
  +     * @return The status which indicates whether the operation is success (AXIS_SUCCESS)
or not     * (AXIS_FAIL).
  +    */
       int logaxis(const char* sLog1, const char* sLog2, int level, char* arg3, int arg4);
  +    /**
  +     * This is called in writing to the log file whose path is specified in $AXIS_HOME/axiscpp.c
    * onf file.
  +     * This method is used when the caller pass first argument as string and the second
argument     * as long. First is his own message.
  +     * The other may be to print a trace value. User can also specify the severity of the
messag     * e by
  +     * assigning level argument to one of CRITICAL, WARN, INFO or TRIVIAL.
  +     * @param sLog1 string message one
  +     * @param sLog2 string message two  
  +     * @param level severity level
  +     * @param arg3 file name
  +     * @param arg4 line number
  +     * @return The status which indicates whether the operation is success (AXIS_SUCCESS)
or not     * (AXIS_FAIL).
  +    */
  +    int logaxis(const char* sLog1, const long nLog2, int level, char* arg3, int arg4);
  +    /**
  +     * This is called in writing to the log file whose path is specified in $AXIS_HOME/axiscpp.c
    * onf file.
  +     * This method is used when the caller pass first argument as string and the second
argument     * as double. First is his own message.
  +     * The other may be to print a trace value. User can also specify the severity of the
messag     * e by
  +     * assigning level argument to one of CRITICAL, WARN, INFO or TRIVIAL.
  +     * @param sLog1 string message one
  +     * @param sLog2 string message two  
  +     * @param level severity level
  +     * @param arg3 file name
  +     * @param arg4 line number
  +     * @return The status which indicates whether the operation is success (AXIS_SUCCESS)
or not     * (AXIS_FAIL).
  +    */
  +    int logaxis(const char* sLog1, const double dLog2, int level, char* arg3, int arg4);
   	/**
   	 * Writes the given string to the standard console. This method is useful when using
        * the standalone server.
  
  
  
  1.16      +63 -39    ws-axis/c/src/common/AxisTrace.cpp
  
  Index: AxisTrace.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/common/AxisTrace.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AxisTrace.cpp	26 Apr 2004 04:04:36 -0000	1.15
  +++ AxisTrace.cpp	27 Apr 2004 03:50:34 -0000	1.16
  @@ -43,7 +43,7 @@
   
   int AxisTrace::openFile ()
   {
  -    char* sFileName = g_pConfig->getAxisLogPath ();
  +    char* sFileName = g_pConfig->GetAxisLogPath ();
       if ((fileTrace = fopen (sFileName, "a")) == NULL)
           return AXIS_FAIL;
       fclose (fileTrace);
  @@ -61,6 +61,7 @@
       if ((fileTrace = fopen (sFileName, "a")) == NULL)
           return AXIS_FAIL;
   
  +    free(setPerm);
       return AXIS_SUCCESS;
   }
   
  @@ -74,7 +75,8 @@
       return AXIS_SUCCESS;
   }
   
  -int AxisTrace::logaxis (const char* sLog, int level, char* arg2, int arg3)
  +
  +int AxisTrace::logthis (const char* sLog, int level, char* arg2, int arg3)
   {
       time_t ltime;
       time (&ltime);
  @@ -110,6 +112,15 @@
       fputs (strLine, fileTrace);
       fputs ("\n", fileTrace);
       fputs (sLog, fileTrace);
  +    fputs (":", fileTrace);
  +
  +    return AXIS_SUCCESS;
  +
  +}
  +int AxisTrace::logaxis (const char* sLog, int level, char* arg2, int arg3)
  +{
  +    
  +    int intResult = logthis(sLog, level, arg2, arg3);
       fputs ("\n", fileTrace);
       fputs ("-------------------------------------------------", fileTrace);
       fputs ("\n", fileTrace);
  @@ -117,54 +128,67 @@
       fflush (fileTrace);
   
       return AXIS_SUCCESS;
  -
   }
   
   int AxisTrace::logaxis (const char* sLog1, const char* sLog2, int level,
       char* arg3, int arg4)
   {
  -    time_t ltime;
  -    time (&ltime);
  -
  -    fputs ("Severity Level : ", fileTrace);
  -    switch (level)
  +    int intResult = logthis(sLog1, level, arg3, arg4);
  +    if(AXIS_SUCCESS == intResult)
       {
  -        case 1:
  -            strLevel = "CRITICAL";
  -            break;
  -        case 2:
  -            strLevel = "WARN";
  -            break;
  -        case 3:
  -            strLevel = "INFO";
  -            break;
  -        case 4:
  -            strLevel = "TRIVIAL";
  -            break;
  +        fputs (sLog2, fileTrace);
  +        fputs ("\n", fileTrace);
  +        fputs ("-------------------------------------------------", fileTrace);
  +        fputs ("\n", fileTrace);
  +
  +        fflush (fileTrace);
  +
  +        return AXIS_SUCCESS;
       }
  -    fputs (strLevel, fileTrace);
  -    fputs ("\n", fileTrace);
  +    return AXIS_FAIL;
   
  -    fputs ("time : ", fileTrace);
  -    fputs (ctime (&ltime), fileTrace);
  -    fputs ("file : ", fileTrace);
  -    fputs (arg3, fileTrace);
  -    fputs ("\n", fileTrace);
  -    fputs ("line : ", fileTrace);
  -    sprintf (strLine, "%d", arg4);
  -    fputs (strLine, fileTrace);
  -    fputs ("\n", fileTrace);
  -    fputs (sLog1, fileTrace);
  -    fputs (" ", fileTrace);
  -    fputs (sLog2, fileTrace);
  -    fputs ("\n", fileTrace);
  -    fputs ("-------------------------------------------------", fileTrace);
  -    fputs ("\n", fileTrace);
  +}
   
  -    fflush (fileTrace);
  +int AxisTrace::logaxis (const char* sLog1, const long nLog2, int level,
  +    char* arg3, int arg4)
  +{
  +    char* convToLong = (char*) malloc(4 * sizeof(char));
  +    int intResult = logthis(sLog1, level, arg3, arg4);
  +    if(AXIS_SUCCESS == intResult)
  +    {
  +	sprintf(convToLong, "%d", nLog2);
  +        fputs (convToLong, fileTrace);
  +        fputs ("\n", fileTrace);
  +        fputs ("-------------------------------------------------", fileTrace);
  +        fputs ("\n", fileTrace);
   
  -    return AXIS_SUCCESS;
  +        fflush (fileTrace);
  +
  +        return AXIS_SUCCESS;
  +    }
  +    free(convToLong);
  +    return AXIS_FAIL;
  +}
   
  +int AxisTrace::logaxis (const char* sLog1, const double dLog2, int level,
  +    char* arg3, int arg4)
  +{
  +    char* convToDouble = (char*) malloc(4 * sizeof(char));
  +    int intResult = logthis(sLog1, level, arg3, arg4);
  +    if(AXIS_SUCCESS == intResult)
  +    {
  +	sprintf(convToDouble, "%f", dLog2);
  +        fputs (convToDouble, fileTrace);
  +        fputs ("\n", fileTrace);
  +        fputs ("-------------------------------------------------", fileTrace);
  +        fputs ("\n", fileTrace);
  +
  +        fflush (fileTrace);
  +
  +        return AXIS_SUCCESS;
  +    }
  +    free(convToDouble);
  +    return AXIS_FAIL;
   }
   
   int AxisTrace::trace (const char *pchLog)
  
  
  

Mime
View raw message