(file) Return to TraceFileHandler.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 martin 1.18 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.19 //
  3 martin 1.18 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.19 //
 10 martin 1.18 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.19 //
 17 martin 1.18 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.19 //
 20 martin 1.18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.19 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.18 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.19 //
 28 martin 1.18 //////////////////////////////////////////////////////////////////////////
 29 mike   1.2  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             
 33             #ifndef Pegasus_TraceFileHandler_h
 34             #define Pegasus_TraceFileHandler_h
 35             
 36             #include <cstdarg>
 37             #include <cstdio>
 38             #include <Pegasus/Common/String.h>
 39 kumpf  1.5  #include <Pegasus/Common/Linkage.h>
 40 r.kieninger 1.15 #include <Pegasus/Common/TraceHandler.h>
 41 mike        1.2  
 42                  PEGASUS_NAMESPACE_BEGIN
 43                  
 44 kumpf       1.13 /** TraceFileHandler implements logging of messages to file
 45 mike        1.2   */
 46                  
 47 r.kieninger 1.15 class PEGASUS_COMMON_LINKAGE TraceFileHandler: public TraceHandler
 48 mike        1.2  {
 49                  private:
 50                  
 51 marek       1.21     enum ErrLogMessageIds
 52                      {
 53                          TRCFH_FAILED_TO_OPEN_FILE_SYSMSG,
 54                          TRCFH_UNEXPECTED_FILE_OWNER,
 55                          TRCFH_FAILED_TO_SET_FILE_PERMISSIONS,
 56                          TRCFH_UNABLE_TO_WRITE_TRACE_TO_FILE,
 57                      };
 58                  
 59 kumpf       1.10     /** Open the specified file in append mode and ensure the file owner and
 60                          permissions are appropriate.
 61                          @param    fileName Full path of the file to open.
 62                          @return   Handle to the opened file if successful, otherwise 0.
 63                       */
 64                      FILE* _openFile(const char* fileName);
 65                  
 66 marek       1.21     /** Function writes an error message to the log, but only once.
 67 ajay.rao    1.22         This function is not thread safe which has to be taken care by the
 68                          caller.
 69 marek       1.21         @param    specifies the type of error message
 70                          @param    parms MessageLoaderParms object containing the localizable
 71                                    message to log.
 72                       */
 73                      void _logError(ErrLogMessageIds msgID, const MessageLoaderParms & parms);
 74                  
 75 amit99shah  1.24     /* Function checking files exists or not and return boolean value
 76                         if file not there then it will create file */
 77                      Boolean _fileExists(char* fileName);
 78                   
 79 mike        1.2      /* File path to write messages
 80                       */
 81                      char* _fileName;
 82                  
 83 dl.meetei   1.23 
 84                      /* Handle to the File
 85                       */
 86                      FILE* _fileHandle;
 87                  
 88                      /* Flag to track writing of message to log
 89                       */
 90                      Uint16 _logErrorBitField;
 91                      Boolean _configHasChanged;
 92                  
 93 mike        1.2  public:
 94                  
 95 r.kieninger 1.15     /** Writes message with format string to the tracing facility
 96 mike        1.2          @param    message  message to be written
 97 thilo.boehm 1.16         @param    msgLen   lenght of message without terminating '\0'
 98 mike        1.2          @param    fmt      printf style format string
 99                          @param    argList  variable argument list
100                       */
101 r.kieninger 1.15     virtual void handleMessage(const char* message,
102 thilo.boehm 1.16                                Uint32 msgLen,
103 r.kieninger 1.15                                const char* fmt,
104                                                 va_list argList);
105 mike        1.2  
106 r.kieninger 1.15     /** Writes simple message to the tracing facility.
107 marek       1.14         @param    message  message to be written
108 thilo.boehm 1.16         @param    msgLen   lenght of message without terminating '\0'
109 marek       1.14      */
110 thilo.boehm 1.16     virtual void handleMessage(const char* message,
111                                                 Uint32 msgLen);
112 marek       1.14 
113                  
114 kumpf       1.20     /** Informs the message handler that the configuraion
115 thilo.boehm 1.17         of the trace has been updated.
116 mike        1.2       */
117 thilo.boehm 1.17     virtual void configurationUpdated();
118 mike        1.2  
119 amit99shah  1.24     /** Sets the Max trace file size for cimserver.trc
120                          @param   maxTraceFileSizeBytes maximum trace file size in bytes
121                       */
122                      void setMaxTraceFileSize (Uint32 maxTraceFileSizeBytes);
123                  
124                      /** Sets the Max trace file number for cimserver.trc in trace folder
125                          @param   maxTraceFileNumber maximum trace number
126                       */
127                      void setMaxTraceFileNumber(Uint32 maxTraceFileNumber);
128                  
129                      /** Create a new trace file until number of files reach
130                          after that it will start rolling all files 
131                          (means it will start replacing older files with new files). 
132                          @param fileName file to roll, this is the trace file name
133                       */
134                      void rollTraceFile(const char* fileName);
135                  
136 mike        1.2      TraceFileHandler();
137                  
138 r.kieninger 1.15     virtual ~TraceFileHandler();
139 kumpf       1.7  
140 marek       1.14 private:
141 amit99shah  1.24    
142 thilo.boehm 1.17     void _reConfigure(void);
143 amit99shah  1.24     Uint32 _maxTraceFileSizeBytes;
144                      Uint32 _maxTraceFileNumber;
145 mike        1.2  };
146                  
147                  PEGASUS_NAMESPACE_END
148                  
149                  #endif /* Pegasus_TraceFileHandler_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2