Apache Log4cxx  Version 1.8.0
Loading...
Searching...
No Matches
socketappenderskeleton.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_SOCKET_APPENDER_SKELETON_H
19#define _LOG4CXX_NET_SOCKET_APPENDER_SKELETON_H
20
23#if LOG4CXX_ABI_VERSION <= 15
25#endif
26
27
28namespace LOG4CXX_NS
29{
30
31namespace net
32{
33
83class LOG4CXX_EXPORT SocketAppenderSkeleton : public AppenderSkeleton
84{
85 protected:
86 struct SocketAppenderSkeletonPriv;
87
88 public:
89 SocketAppenderSkeleton(int defaultPort, int reconnectionDelay);
91
95#if LOG4CXX_ABI_VERSION <= 15
96 SocketAppenderSkeleton(helpers::InetAddressPtr address, int port, int reconnectionDelay);
97#else
98 SocketAppenderSkeleton(const helpers::InetAddressPtr& address, int port, int reconnectionDelay);
99#endif
103 SocketAppenderSkeleton(const LogString& host, int port, int reconnectionDelay);
104
112
113 void close() override;
114
115#if LOG4CXX_ABI_VERSION <= 15
121 bool requiresLayout() const override
122 {
123 return false;
124 }
125#endif
131 void setRemoteHost(const LogString& host);
132
136 const LogString& getRemoteHost() const;
137
142 void setPort(int port1);
143
147 int getPort() const;
148
154 void setLocationInfo(bool locationInfo1);
155
159 bool getLocationInfo() const;
160
170 void setReconnectionDelay(int reconnectionDelay1);
171
176
177#if LOG4CXX_ABI_VERSION <= 15
182#else
186 void setSocketSubclass(const LogString& newSubclass);
187
191 const LogString& getSocketSubclass() const;
192#endif
193
212 void setOption(const LogString& option, const LogString& value) override;
213
214 protected:
215 SocketAppenderSkeleton(std::unique_ptr<SocketAppenderSkeletonPriv> priv);
216
217#if LOG4CXX_ABI_VERSION <= 15
221 virtual void setSocket(helpers::SocketPtr& socket, helpers::Pool& p) = 0;
222
226 virtual void cleanUp(LOG4CXX_NS::helpers::Pool& p) = 0;
227#endif
228 virtual int getDefaultDelay() const = 0;
229
230 virtual int getDefaultPort() const = 0;
231
232 private:
233
236
237}; // class SocketAppenderSkeleton
238} // namespace net
239} // namespace log4cxx
240
241#endif // _LOG4CXX_NET_SOCKET_APPENDER_SKELETON_H
242
AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv)
Definition pool.h:33
virtual void cleanUp(log4cxx::helpers::Pool &p)=0
void close() override
Release any resources allocated within the appender such as file handles, network connections,...
SocketAppenderSkeleton(int defaultPort, int reconnectionDelay)
bool requiresLayout() const override
This appender does not use a layout.
Definition socketappenderskeleton.h:121
SocketAppenderSkeleton(std::unique_ptr< SocketAppenderSkeletonPriv > priv)
SocketAppenderSkeleton(const LogString &host, int port, int reconnectionDelay)
Connects to remote server at host and port.
bool getLocationInfo() const
Returns value of the LocationInfo option.
int getReconnectionDelay() const
Returns value of the ReconnectionDelay option.
SocketAppenderSkeleton(helpers::InetAddressPtr address, int port, int reconnectionDelay)
Connects to remote server at address and port.
void setPort(int port1)
The Port option takes a positive integer representing the port where the server is waiting for connec...
int getPort() const
Returns value of the Port option.
void setReconnectionDelay(int reconnectionDelay1)
The ReconnectionDelay option takes a positive integer representing the number of milliseconds to wait...
void setRemoteHost(const LogString &host)
The RemoteHost option takes a string value which should be the host name of the server where a Apache...
const LogString & getRemoteHost() const
Returns value of the RemoteHost option.
void activateOptions(helpers::Pool &p) override
void setOption(const LogString &option, const LogString &value) override
Set option to value.
virtual int getDefaultDelay() const =0
void setLocationInfo(bool locationInfo1)
The LocationInfo option takes a boolean value.
virtual int getDefaultPort() const =0
virtual void setSocket(helpers::SocketPtr &socket, helpers::Pool &p)=0
std::basic_string< logchar > LogString
Definition logstring.h:60
#define LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS
Activate the options that were previously set with calls to option setters.
Definition optionhandler.h:53