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.37 2012/02/29 12:50:09 tstaig 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.37 2012/02/29 12:50:09 tstaig 00151 // Changes were made to remove warning "'visibility' attribute ignored on non-class 00152 // types" messages. 00153 // 00154 // Revision 1.36 2012/01/20 22:07:52 tstaig 00155 // Backport from branches ACS-9_0_0-windows-B and ACS-9_1_0-windows-B to support 00156 // ACS on Windows under Cygwin. This commit corresponds to the folowing 00157 // CommonSoftware modules: 00158 // jacsutil acsEclipseUtils xmljbind xmlpybind acserridl acsidlcommon acsutil 00159 // acsutilpy acsstartup loggingidl logging acserr acserrTypes acsQoS 00160 // Along with adding dependencies for some libraries in acsdaemon and acstime 00161 // modules so they would be built correctly. 00162 // 00163 // Revision 1.35 2009/01/26 06:45:26 cparedes 00164 // Changing from int to ssize_t 00165 // 00166 // Revision 1.34 2003/03/14 10:24:37 rgeorgie 00167 // LGPL 00168 // 00169 // Revision 1.33 2002/09/23 12:43:05 vltsccm 00170 // msekoran: loggingXMLParser fixed, memory leak removed and tat test added. 00171 // 00172 // Revision 1.32 2002/04/10 14:41:38 vltsccm 00173 // logging1.32 00174 // 00175 // Revision 1.31 2002/03/27 16:44:23 vltsccm 00176 // logging1.31 00177 // 00178 // Revision 1.30 2002/02/13 12:55:31 vltsccm 00179 // logging1.30 00180 // 00181 // Revision 1.29 2002/02/08 13:40:54 vltsccm 00182 // logging1.29 00183 // 00184 // Revision 1.28 2002/02/05 17:51:54 vltsccm 00185 // logging1.28 00186 // 00187 // Revision 1.27 2002/02/04 08:26:28 vltsccm 00188 // logging1.27 00189 // 00190 // Revision 1.26 2002/01/18 09:42:58 vltsccm 00191 // logging1.26 00192 // 00193 // Revision 1.25 2002/01/16 10:41:29 vltsccm 00194 // logging1.25 00195 // 00196 // Revision 1.24 2002/01/15 12:42:19 vltsccm 00197 // logging1.24 00198 // 00199 // Revision 1.23 2002/01/14 21:10:49 vltsccm 00200 // logging1.23 00201 // 00202 // Revision 1.22 2001/12/27 19:04:09 vltsccm 00203 // logging1.22 00204 // 00205 // Revision 1.21 2001/12/24 13:31:05 vltsccm 00206 // logging1.21 00207 // 00208 // Revision 1.20 2001/12/24 13:31:05 vltsccm 00209 // logging1.20 00210 // 00211 // Revision 1.19 2001/12/24 13:31:05 vltsccm 00212 // logging1.19 00213 // 00214 // Revision 1.18 2001/12/24 13:31:04 vltsccm 00215 // logging1.18 00216 // 00217 // Revision 1.17 2001/12/24 13:31:04 vltsccm 00218 // logging1.17 00219 // 00220 // Revision 1.16 2001/12/24 13:31:04 vltsccm 00221 // logging1.16 00222 // 00223 // Revision 1.15 2001/12/24 13:31:03 vltsccm 00224 // logging1.15 00225 // 00226 // Revision 1.14 2001/12/24 13:31:03 vltsccm 00227 // logging1.14 00228 // 00229 // Revision 1.13 2001/12/24 13:31:03 vltsccm 00230 // logging1.13 00231 // 00232 // Revision 1.12 2001/12/24 13:31:02 vltsccm 00233 // logging1.12 00234 // 00235 // Revision 1.11 2001/12/24 13:31:02 vltsccm 00236 // logging1.11 00237 // 00238 // Revision 1.10 2001/12/24 13:31:02 vltsccm 00239 // logging1.10 00240 // 00241 // Revision 1.9 2001/12/24 13:31:01 vltsccm 00242 // logging1.9 00243 // 00244 // Revision 1.8 2001/12/24 13:31:01 vltsccm 00245 // logging1.8 00246 // 00247 // Revision 1.7 2001/12/24 13:31:01 vltsccm 00248 // logging1.7 00249 // 00250 // Revision 1.6 2001/12/24 13:31:00 vltsccm 00251 // logging1.6 00252 // 00253 // Revision 1.5 2001/12/24 13:31:00 vltsccm 00254 // logging1.5 00255 // 00256 // Revision 1.4 2001/12/24 13:31:00 vltsccm 00257 // logging1.4 00258 // 00259 // Revision 1.3 2001/12/24 13:30:59 vltsccm 00260 // logging1.3 00261 // 00262 // Revision 1.2 2001/12/24 13:30:59 vltsccm 00263 // logging1.2 00264 // 00265 // Revision 1.1 2001/12/24 13:30:59 vltsccm 00266 // logging1.1 00267 // 00268 // Revision 1.0 2001/12/24 13:30:59 vltsccm 00269 // logging1.0 00270 // 00271 // 00272 // ************************************************************************