Apache Log4cxx  Version 1.2.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_NS
29{
30namespace helpers
31{
32class ByteBuffer;
33}
34namespace net
35{
36typedef LOG4CXX_NS::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
101 void setEncoding(const LogString& value);
102
103
110
111
122 void setOption(const LogString& option, const LogString& value) override;
123
127 int getPort() const;
128
133 void setPort(int port1);
134
135
137 void close() override;
138
139 protected:
142 void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
143
144 //---------------------------------------------------------- SocketHandler:
145
146 private:
147 // prevent copy and assignment statements
149 TelnetAppender& operator=(const TelnetAppender&);
150
151 void write(LOG4CXX_NS::helpers::ByteBuffer&);
152 void writeStatus(const LOG4CXX_NS::helpers::SocketPtr& socket, const LogString& msg, LOG4CXX_NS::helpers::Pool& p);
153 void acceptConnections();
154
155 struct TelnetAppenderPriv;
156}; // class TelnetAppender
157
159} // namespace net
160} // namespace log4cxx
161
162#endif // _LOG4CXX_NET_TELNET_APPENDER_H
163
Implementation base class for all appenders.
Definition: appenderskeleton.h:41
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
The current encoding value.
int getPort() const
Returns value of the Port option.
void setEncoding(const LogString &value)
Set the encoding to value.
log4cxx::helpers::SocketPtr Connection
Definition: telnetappender.h:36
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:32
LOG4CXX_LIST_DEF(AppenderList, AppenderPtr)
std::basic_string< logchar > LogString
Definition: logstring.h:60
LOG4CXX_PTR_DEF(Appender)
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:158
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:152
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:43
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:164
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:146