Apache Log4cxx  Version 1.7.0
Loading...
Searching...
No Matches
telnetappender.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_TELNET_APPENDER_H
19#define _LOG4CXX_NET_TELNET_APPENDER_H
20
23
24namespace LOG4CXX_NS
25{
26namespace helpers
27{
28class ByteBuffer;
29}
30namespace net
31{
32
52class LOG4CXX_EXPORT TelnetAppender : public AppenderSkeleton
53{
54 private:
55 static const int DEFAULT_PORT;
56 static const int MAX_CONNECTIONS;
57
58 public:
64
67
71 bool requiresLayout() const override;
72
84 void setEncoding(const LogString& value);
85
86
92 void activateOptions(helpers::Pool& p) override;
93
94
109 void setOption(const LogString& option, const LogString& value) override;
110
114 int getPort() const;
115
119 void setPort(int newValue);
120
125
130 void setHostname(const LogString& newValue);
131
137 int getMaxConnections() const;
138
144 void setMaxConnections(int newValue);
145
153 void setReuseAddress(bool newValue);
154
162 void setNonBlocking(bool newValue);
163
165 void close() override;
166
167 protected:
170 void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
171
172 private:
173 // prevent copy and assignment statements
175 TelnetAppender& operator=(const TelnetAppender&);
176
177 void write(helpers::ByteBuffer&);
178 void writeStatus(const helpers::SocketPtr& socket, const LogString& msg, helpers::Pool& p);
179 void acceptConnections();
180
181 struct TelnetAppenderPriv;
182}; // class TelnetAppender
183
185} // namespace net
186} // namespace log4cxx
187
188#endif // _LOG4CXX_NET_TELNET_APPENDER_H
189
AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv)
The TelnetAppender writes log messages to clients that connect to the TCP port.
Definition telnetappender.h:53
void close() override
Shutdown this appender.
void activateOptions(helpers::Pool &p) override
Activate the options that were previously set with calls to option setters.
void append(const spi::LoggingEventPtr &event, helpers::Pool &p) override
Send event to each connected client.
LogString getHostname() const
The Hostname on which to accept connections.
void setReuseAddress(bool newValue)
Use newValue for the SO_REUSEADDR option of the socket accepting connections.
void setOption(const LogString &option, const LogString &value) override
Set option to value.
LogString getEncoding() const
The current encoding value.
int getPort() const
The TCP Port number on which to accept connections.
void setEncoding(const LogString &value)
Set the encoding to value.
void setHostname(const LogString &newValue)
Use newValue as the Hostname on which to accept connections.
void setMaxConnections(int newValue)
Set the number of allowed concurrent connections to newValue.
bool requiresLayout() const override
If no layout is provided, sends only the log message to attached client(s).
void setPort(int newValue)
Use newValue as the TCP port number on which to accept connections.
int getMaxConnections() const
The number of allowed concurrent connections.
void setNonBlocking(bool newValue)
Use newValue for the behaviour when the TCP send buffer (on an accepted socket connection) is full.
Definition propertysetter.h:27
LOG4CXX_PTR_DEF(SMTPAppender)
Definition appender.h:30
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