00001 /*************************************************************************** 00002 ulxr_log4j.h - logging based on log4j 00003 ------------------- 00004 begin : Fri Jul 13 2007 00005 copyright : (C) 2002-2007 by Ewald Arnold 00006 email : ulxmlrpcpp@ewald-arnold.de 00007 00008 $Id: ulxr_Log4JSender.h 940 2006-12-30 18:22:05Z ewald-arnold $ 00009 00010 ***************************************************************************/ 00011 00012 /************************************************************************** 00013 * 00014 * This program is free software; you can redistribute it and/or modify 00015 * it under the terms of the GNU Lesser General Public License as 00016 * published by the Free Software Foundation; either version 2 of the License, 00017 * or (at your option) any later version. 00018 * 00019 * This program is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 * GNU General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this program; if not, write to the Free Software 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00027 * 00028 ***************************************************************************/ 00029 00030 #ifndef ULXR_LOG4J_H 00031 #define ULXR_LOG4J_H 00032 00033 #include <ulxmlrpcpp/ulxmlrpcpp.h> // always first header 00034 00035 #ifndef ULXR_OMIT_TCP_STUFF 00036 00037 namespace ulxr { 00038 00039 class TcpIpConnection; 00040 00041 00044 class ULXR_API_DECL0 Log4JSender 00045 { 00046 public: 00047 00050 Log4JSender(const CppString &appname, TcpIpConnection &conn); 00051 00054 ~Log4JSender() throw(); 00055 00058 void open(); 00059 00062 void close(); 00063 00070 void send(const CppString &level, const CppString &message, 00071 const CppString &filename = ULXR_PCHAR(""), unsigned line = 0); 00072 00077 ULXR_INT64 currentTimeMillis(); 00078 00079 private: 00080 00081 CppString appname; 00082 TcpIpConnection &conn; 00083 bool network_error; 00084 CppString threadname; 00085 unsigned long seqnum; 00086 std::string hostname; 00087 bool disable_send; 00088 CppString classname; 00089 CppString methodname; 00090 bool first_log4j; 00091 }; 00092 00093 00094 } // namespace ulxr 00095 00096 #endif // ULXR_OMIT_TCP_STUFF 00097 00098 #endif // ULXR_LOG4J_H