Apache Log4cxx  Version 2.0.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
24
25namespace LOG4CXX_NS
26{
27
28namespace net
29{
30
80class LOG4CXX_EXPORT SocketAppenderSkeleton : public AppenderSkeleton
81{
82 protected:
83 struct SocketAppenderSkeletonPriv;
84
85 public:
90 SocketAppenderSkeleton(int defaultPort, int millisecondDelay);
91
96
101 SocketAppenderSkeleton(const helpers::InetAddressPtr& address, int port, int millisecondDelay);
102
107 SocketAppenderSkeleton(const LogString& host, int port, int millisecondDelay);
108
113 void activateOptions( ) override;
114
118 void append( const spi::LoggingEventPtr& event ) override;
119
123 void setRemoteHost(const LogString& newValue);
124
128 const LogString& getRemoteHost() const;
129
134 void setPort(int newValue);
135
139 int getPort() const;
140
147 void setReconnectionDelay(int millisecondDelay);
148
155
159 void setSocketSubclass(const LogString& newSubclass);
160
165
183 void setOption(const LogString& option, const LogString& value) override;
184
185 protected:
186 SocketAppenderSkeleton(std::unique_ptr<SocketAppenderSkeletonPriv> priv);
187
188 virtual int getDefaultDelay() const = 0;
189
190 virtual int getDefaultPort() const = 0;
191
192 private:
193
196
197}; // class SocketAppenderSkeleton
198} // namespace net
199} // namespace log4cxx
200
201#endif // _LOG4CXX_NET_SOCKET_APPENDER_SKELETON_H
202
AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv)
SocketAppenderSkeleton(int defaultPort, int millisecondDelay)
A unconnected appender sending to defaultPort, with a retry after millisecondDelay when unable to est...
const LogString & getSocketSubclass() const
The class name used for the helpers::Socket interface implemention.
void activateOptions() override
Connects to the configured RemoteHost and Port.
SocketAppenderSkeleton(const helpers::InetAddressPtr &address, int port, int millisecondDelay)
A remote server at address and port, with a retry after millisecondDelay when unable to establish a c...
SocketAppenderSkeleton(std::unique_ptr< SocketAppenderSkeletonPriv > priv)
void setRemoteHost(const LogString &newValue)
Use newValue as the name of the server.
int getReconnectionDelay() const
The value of the ReconnectionDelay option, the number of milliseconds to wait between each failed con...
int getPort() const
Returns value of the Port option.
void setSocketSubclass(const LogString &newSubclass)
Use newSubclass as the helpers::Socket interface instead of the default implementation.
void setReconnectionDelay(int millisecondDelay)
Use millisecondDelay as the number of milliseconds to wait between each failed connection attempt to ...
SocketAppenderSkeleton(const LogString &host, int port, int millisecondDelay)
A remote server at host and port, with a retry after millisecondDelay when unable to establish a conn...
~SocketAppenderSkeleton()
Close and shutdown the connection if not already done.
const LogString & getRemoteHost() const
Returns value of the RemoteHost option.
void setPort(int newValue)
Use newValue, which must be a positive integer, as the port on which the server is waiting for connec...
void append(const spi::LoggingEventPtr &event) override
Sends the message that the configured Layout produces from event to the output sink.
void setOption(const LogString &option, const LogString &value) override
Override this method to set option to value.
virtual int getDefaultDelay() const =0
virtual int getDefaultPort() const =0
virtual void activateOptions()=0
Activate the options that were previously set with calls to option setters.
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition appender.h:32
std::basic_string< logchar > LogString
Definition logstring.h:51