Apache Log4cxx  Version 1.8.0
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 
22 #include <log4cxx/helpers/socket.h>
23 
24 namespace LOG4CXX_NS
25 {
26 namespace helpers
27 {
28 class ByteBuffer;
29 }
30 namespace net
31 {
32 
52 class 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 
78  LogString getEncoding() const;
84  void setEncoding(const LogString& value);
85 
86 
87  using AppenderSkeleton::activateOptions;
93  void activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override;
94 
95 
110  void setOption(const LogString& option, const LogString& value) override;
111 
115  int getPort() const;
116 
120  void setPort(int newValue);
121 
125  LogString getHostname() const;
126 
131  void setHostname(const LogString& newValue);
132 
138  int getMaxConnections() const;
139 
145  void setMaxConnections(int newValue);
146 
154  void setReuseAddress(bool newValue);
155 
163  void setNonBlocking(bool newValue);
164 
166  void close() override;
167 
168  protected:
171  void append( LOG4CXX_APPEND_FORMAL_PARAMETERS ) override;
172 
173  private:
174  // prevent copy and assignment statements
176  TelnetAppender& operator=(const TelnetAppender&);
177 
178  void write(helpers::ByteBuffer&);
179  void writeStatus(const helpers::SocketPtr& socket, const LogString& msg, helpers::Pool& p);
180  void acceptConnections();
181 
182  struct TelnetAppenderPriv;
183 }; // class TelnetAppender
184 
186 } // namespace net
187 } // namespace log4cxx
188 
189 #endif // _LOG4CXX_NET_TELNET_APPENDER_H
190 
#define LOG4CXX_APPEND_FORMAL_PARAMETERS
Log in Appender specific way.
Definition: appender.h:92
Implementation base class for all appenders.
Definition: appenderskeleton.h:45
The TelnetAppender writes log messages to clients that connect to the TCP port.
Definition: telnetappender.h:53
LOG4CXX_PTR_DEF(TelnetAppender)
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
#define LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS
Activate the options that were previously set with calls to option setters.
Definition: optionhandler.h:53