Apache Log4cxx Version 1.1.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
24#include <thread>
25#include <vector>
27
28namespace log4cxx
29{
30namespace helpers
31{
32class ByteBuffer;
33}
34namespace net
35{
36typedef log4cxx::helpers::SocketPtr Connection;
38
64class LOG4CXX_EXPORT TelnetAppender : public AppenderSkeleton
65{
66 class SocketHandler;
67 friend class SocketHandler;
68 private:
69 static const int DEFAULT_PORT;
70 static const int MAX_CONNECTIONS;
71
72 public:
78
81
85 bool requiresLayout() const override
86 {
87 return true;
88 }
89
91 void setEncoding(const LogString& value);
92
93
99 void activateOptions(helpers::Pool& p) override;
100
101
112 void setOption(const LogString& option, const LogString& value) override;
113
117 int getPort() const;
118
123 void setPort(int port1);
124
125
127 void close() override;
128
129 protected:
132 void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
133
134 //---------------------------------------------------------- SocketHandler:
135
136 private:
137 // prevent copy and assignment statements
139 TelnetAppender& operator=(const TelnetAppender&);
140
141 void write(log4cxx::helpers::ByteBuffer&);
142 void writeStatus(const log4cxx::helpers::SocketPtr& socket, const LogString& msg, log4cxx::helpers::Pool& p);
143 void acceptConnections();
144
145 struct TelnetAppenderPriv;
146}; // class TelnetAppender
147
149} // namespace net
150} // namespace log4cxx
151
152#endif // _LOG4CXX_NET_TELNET_APPENDER_H
153
Implementation base class for all appenders.
Definition: appenderskeleton.h:41
A byte buffer.
Definition: bytebuffer.h:34
Definition: pool.h:33
Definition: telnetappender.h:65
void close() override
shuts down the 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
Handles a log event.
void setPort(int port1)
The Port option takes a positive integer representing the port where the server is waiting for connec...
void setOption(const LogString &option, const LogString &value) override
Set option to value.
LogString getEncoding() const
int getPort() const
Returns value of the Port option.
void setEncoding(const LogString &value)
LOG4CXX_LIST_DEF(ConnectionList, Connection)
log4cxx::helpers::SocketPtr Connection
Definition: telnetappender.h:36
LOG4CXX_PTR_DEF(SMTPAppender)
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:32
Definition: configuration.h:25
std::basic_string< logchar > LogString
Definition: logstring.h:60
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:157
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:151
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:42
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:163
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:145