Apache Log4cxx  Version 1.8.0
xmlsocketappender.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _LOG4CXX_NET_XML_SOCKET_APPENDER_H
19 #define _LOG4CXX_NET_XML_SOCKET_APPENDER_H
20 
22 
23 namespace LOG4CXX_NS
24 {
25 namespace net
26 {
27 
52 class LOG4CXX_EXPORT XMLSocketAppender : public SocketAppenderSkeleton
53 {
54  public:
58  static int DEFAULT_PORT;
59 
64 
65 #if LOG4CXX_ABI_VERSION <= 15
69  static const int MAX_EVENT_LEN;
70 #endif
71 
77 
80 
84 #if LOG4CXX_ABI_VERSION <= 15
85  XMLSocketAppender(helpers::InetAddressPtr address, int port);
86 #else
87  XMLSocketAppender(const helpers::InetAddressPtr& address, int port);
88 #endif
89 
93  XMLSocketAppender(const LogString& host, int port);
94 
95  using SocketAppenderSkeleton::activateOptions;
96 
97 #if 15 < LOG4CXX_ABI_VERSION
102  bool requiresLayout() const override
103  {
104  return false;
105  }
106 #endif
107 
108  protected:
109 #if LOG4CXX_ABI_VERSION <= 15
113  void setSocket(LOG4CXX_NS::helpers::SocketPtr& socket, helpers::Pool& p) override;
114 
118  void cleanUp(helpers::Pool& p) override;
119 #endif
120  int getDefaultDelay() const override;
121 
122  int getDefaultPort() const override;
123 
125 
126  private:
127  // prevent copy and assignment statements
129  XMLSocketAppender& operator=(const XMLSocketAppender&);
130 
131 #if LOG4CXX_ABI_VERSION <= 15
132  struct XMLSocketAppenderPriv;
133 #endif
134 }; // class XMLSocketAppender
135 
137 
138 } // namespace net
139 } // namespace log4cxx
140 
141 #endif // _LOG4CXX_NET_XML_SOCKET_APPENDER_H
142 
#define LOG4CXX_APPEND_FORMAL_PARAMETERS
Log in Appender specific way.
Definition: appender.h:92
Implementation base class for all appenders.
Definition: appenderskeleton.h:45
Definition: pool.h:33
Abstract base class that sends spi::LoggingEvent elements to a remote server.
Definition: socketappenderskeleton.h:84
Sends spi::LoggingEvent elements to a remote a log server, usually in XML format.
Definition: xmlsocketappender.h:53
static int DEFAULT_RECONNECTION_DELAY
The default reconnection delay (30000 milliseconds or 30 seconds).
Definition: xmlsocketappender.h:63
XMLSocketAppender(const LogString &host, int port)
Connects to remote server at host and port.
void setSocket(log4cxx::helpers::SocketPtr &socket, helpers::Pool &p) override
void append(const spi::LoggingEventPtr &event, helpers::Pool &p) override
Subclasses of AppenderSkeleton must implement this method to perform actual logging.
int getDefaultDelay() const override
int getDefaultPort() const override
void cleanUp(helpers::Pool &p) override
static int DEFAULT_PORT
The default port number of remote logging server (4560).
Definition: xmlsocketappender.h:58
XMLSocketAppender(helpers::InetAddressPtr address, int port)
Connects to remote server at address and port.
static const int MAX_EVENT_LEN
Unused.
Definition: xmlsocketappender.h:69
LOG4CXX_PTR_DEF(XMLSocketAppender)
std::basic_string< logchar > LogString
Definition: logstring.h:60
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:154
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:148
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:41
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:160
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:142