00001 #ifndef loggingRemoteSyslog_H 00002 #define loggingRemoteSyslog_H 00003 00004 /******************************************************************************* 00005 * ALMA - Atacama Large Millimiter Array 00006 * (c) European Southern Observatory, 2002 00007 * Copyright by ESO (in the framework of the ALMA collaboration) 00008 * and Cosylab 2002, All rights reserved 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 * 00024 * "@(#) $Id: loggingRemoteSyslog.h,v 1.35 2009/01/26 06:45:26 cparedes Exp $" 00025 * 00026 * who when what 00027 * -------- ---------- ---------------------------------------------- 00028 * msekoran 2001-12-17 created. 00029 */ 00030 00031 #ifndef __cplusplus 00032 #error This is a C++ include file and cannot be used from plain C 00033 #endif 00034 00035 #include <acsutil.h> 00036 #include <loggingExport.h> 00037 #include <loggingCacheLogger.h> 00038 00039 #include <ace/Log_Record.h> 00040 #include <ace/Log_Msg_Backend.h> 00041 00042 #include <ace/SString.h> 00043 00044 #ifndef ACS_HAS_LOCAL_SYSLOG_CALLS 00045 00046 /* 00047 syslog priorities, facilities 00048 ----------------------------- 00049 */ 00050 00051 #define LOG_EMERG 0 // system is unusable 00052 #define LOG_ALERT 1 // action must be taken immediately 00053 #define LOG_CRIT 2 // critical conditions 00054 #define LOG_ERR 3 // error conditions 00055 #define LOG_WARNING 4 // warning conditions 00056 #define LOG_NOTICE 5 // normal but significant condition 00057 #define LOG_INFO 6 // informational 00058 #define LOG_DEBUG 7 // debug-level messages 00059 00060 #define LOG_USER (1<<3) // random user-level messages 00061 00062 #define LOG_LOCAL0 (16<<3) 00063 #define LOG_LOCAL1 (17<<3) 00064 #define LOG_LOCAL2 (18<<3) 00065 #define LOG_LOCAL3 (19<<3) 00066 #define LOG_LOCAL4 (20<<3) 00067 #define LOG_LOCAL5 (21<<3) 00068 #define LOG_LOCAL6 (22<<3) 00069 #define LOG_LOCAL7 (23<<3) 00070 00071 #else 00072 00073 #include <syslog.h> 00074 00075 #endif 00076 00077 #include <ace/SOCK_Dgram.h> 00078 #include <ace/INET_Addr.h> 00079 00084 class logging_EXPORT RemoteSyslogLogger : public CacheLogger 00085 { 00086 public: 00087 00089 typedef struct { 00090 const ACE_TCHAR * name; 00091 int value; 00092 } facilityPair; 00093 00095 static facilityPair m_facilityNames[]; 00096 00099 RemoteSyslogLogger (int facility = LOG_USER); 00100 00102 virtual ~RemoteSyslogLogger (void); 00103 00105 virtual int open (const ACE_TCHAR * host); 00106 00108 virtual int reset (void); 00109 00111 virtual int close (void); 00112 00116 virtual ssize_t log (ACE_Log_Record &log_record); 00117 00119 virtual ssize_t log (int priority, const ACE_TCHAR * msg); 00120 00122 virtual const ACE_TCHAR * getIdentification(); 00123 00125 virtual const ACE_TCHAR * getDestination(); 00126 00127 private: 00128 00130 ACE_INET_Addr m_remoteAddress; 00131 00133 ACE_SOCK_Dgram m_socket; 00134 00136 int m_facility; 00137 00139 ACE_CString m_address; 00140 00141 }; 00142 00143 #endif /* loggingRemoteSyslog_H */ 00144 00145 // ************************************************************************ 00146 // 00147 // REVISION HISTORY: 00148 // 00149 // $Log: loggingRemoteSyslog.h,v $ 00150 // Revision 1.35 2009/01/26 06:45:26 cparedes 00151 // Changing from int to ssize_t 00152 // 00153 // Revision 1.34 2003/03/14 10:24:37 rgeorgie 00154 // LGPL 00155 // 00156 // Revision 1.33 2002/09/23 12:43:05 vltsccm 00157 // msekoran: loggingXMLParser fixed, memory leak removed and tat test added. 00158 // 00159 // Revision 1.32 2002/04/10 14:41:38 vltsccm 00160 // logging1.32 00161 // 00162 // Revision 1.31 2002/03/27 16:44:23 vltsccm 00163 // logging1.31 00164 // 00165 // Revision 1.30 2002/02/13 12:55:31 vltsccm 00166 // logging1.30 00167 // 00168 // Revision 1.29 2002/02/08 13:40:54 vltsccm 00169 // logging1.29 00170 // 00171 // Revision 1.28 2002/02/05 17:51:54 vltsccm 00172 // logging1.28 00173 // 00174 // Revision 1.27 2002/02/04 08:26:28 vltsccm 00175 // logging1.27 00176 // 00177 // Revision 1.26 2002/01/18 09:42:58 vltsccm 00178 // logging1.26 00179 // 00180 // Revision 1.25 2002/01/16 10:41:29 vltsccm 00181 // logging1.25 00182 // 00183 // Revision 1.24 2002/01/15 12:42:19 vltsccm 00184 // logging1.24 00185 // 00186 // Revision 1.23 2002/01/14 21:10:49 vltsccm 00187 // logging1.23 00188 // 00189 // Revision 1.22 2001/12/27 19:04:09 vltsccm 00190 // logging1.22 00191 // 00192 // Revision 1.21 2001/12/24 13:31:05 vltsccm 00193 // logging1.21 00194 // 00195 // Revision 1.20 2001/12/24 13:31:05 vltsccm 00196 // logging1.20 00197 // 00198 // Revision 1.19 2001/12/24 13:31:05 vltsccm 00199 // logging1.19 00200 // 00201 // Revision 1.18 2001/12/24 13:31:04 vltsccm 00202 // logging1.18 00203 // 00204 // Revision 1.17 2001/12/24 13:31:04 vltsccm 00205 // logging1.17 00206 // 00207 // Revision 1.16 2001/12/24 13:31:04 vltsccm 00208 // logging1.16 00209 // 00210 // Revision 1.15 2001/12/24 13:31:03 vltsccm 00211 // logging1.15 00212 // 00213 // Revision 1.14 2001/12/24 13:31:03 vltsccm 00214 // logging1.14 00215 // 00216 // Revision 1.13 2001/12/24 13:31:03 vltsccm 00217 // logging1.13 00218 // 00219 // Revision 1.12 2001/12/24 13:31:02 vltsccm 00220 // logging1.12 00221 // 00222 // Revision 1.11 2001/12/24 13:31:02 vltsccm 00223 // logging1.11 00224 // 00225 // Revision 1.10 2001/12/24 13:31:02 vltsccm 00226 // logging1.10 00227 // 00228 // Revision 1.9 2001/12/24 13:31:01 vltsccm 00229 // logging1.9 00230 // 00231 // Revision 1.8 2001/12/24 13:31:01 vltsccm 00232 // logging1.8 00233 // 00234 // Revision 1.7 2001/12/24 13:31:01 vltsccm 00235 // logging1.7 00236 // 00237 // Revision 1.6 2001/12/24 13:31:00 vltsccm 00238 // logging1.6 00239 // 00240 // Revision 1.5 2001/12/24 13:31:00 vltsccm 00241 // logging1.5 00242 // 00243 // Revision 1.4 2001/12/24 13:31:00 vltsccm 00244 // logging1.4 00245 // 00246 // Revision 1.3 2001/12/24 13:30:59 vltsccm 00247 // logging1.3 00248 // 00249 // Revision 1.2 2001/12/24 13:30:59 vltsccm 00250 // logging1.2 00251 // 00252 // Revision 1.1 2001/12/24 13:30:59 vltsccm 00253 // logging1.1 00254 // 00255 // Revision 1.0 2001/12/24 13:30:59 vltsccm 00256 // logging1.0 00257 // 00258 // 00259 // ************************************************************************