log4cplus  2.1.0
log4judpappender.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Module: LOG4CPLUS
3 // File: log4judpappender.h
4 // Created: 7/2012
5 // Author: Siva Chandran P
6 //
7 //
8 // Copyright 2012-2017 Siva Chandran P
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 
24 #ifndef LOG4CPLUS_LOG4J_UDP_APPENDER_HEADER_
25 #define LOG4CPLUS_LOG4J_UDP_APPENDER_HEADER_
26 
27 #include <log4cplus/config.hxx>
28 #include <log4cplus/appender.h>
30 
31 namespace log4cplus {
32 
62  public:
63  // Ctors
64  Log4jUdpAppender(const log4cplus::tstring& host, int port,
65  bool ipv6 = false);
67 
68  // Dtor
70 
71  // Methods
72  virtual void close();
73 
74  protected:
75  void openSocket();
76  virtual void append(const spi::InternalLoggingEvent& event);
77 
78  // Data
81  int port;
82  bool ipv6 = false;
83 
84  private:
85  // Disallow copying of instances of this class
87  Log4jUdpAppender& operator=(const Log4jUdpAppender&);
88  };
89 } // end namespace log4cplus
90 
91 #endif // LOG4CPLUS_LOG4J_UDP_APPENDER_HEADER_
Extend this class for implementing your own strategies for printing log statements.
Definition: appender.h:139
Sends log events as Log4j XML to a remote a log server.
virtual void append(const spi::InternalLoggingEvent &event)
Subclasses of Appender should implement this method to perform actual logging.
Log4jUdpAppender(const log4cplus::tstring &host, int port, bool ipv6=false)
Log4jUdpAppender(const log4cplus::helpers::Properties &properties)
log4cplus::helpers::Socket socket
virtual void close()
Release any resources allocated within the appender such as file handles, network connections,...
This class implements client sockets (also called just "sockets").
The internal representation of logging events.
Definition: loggingevent.h:51
std::basic_string< tchar > tstring
Definition: tstring.h:39
#define LOG4CPLUS_EXPORT
Definition: win32.h:141