/usr/include/log4cxx/net/socketappenderskeleton.h is in liblog4cxx-dev 0.10.0-13ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _LOG4CXX_NET_SOCKET_APPENDER_SKELETON_H
#define _LOG4CXX_NET_SOCKET_APPENDER_SKELETON_H
#include <log4cxx/appenderskeleton.h>
#include <log4cxx/helpers/socket.h>
#include <log4cxx/helpers/thread.h>
#include <log4cxx/helpers/objectoutputstream.h>
namespace log4cxx
{
namespace net
{
/**
* Abstract base class for SocketAppender and XMLSocketAppender
*/
class LOG4CXX_EXPORT SocketAppenderSkeleton : public AppenderSkeleton
{
private:
/**
host name
*/
LogString remoteHost;
/**
IP address
*/
helpers::InetAddressPtr address;
int port;
int reconnectionDelay;
bool locationInfo;
public:
SocketAppenderSkeleton(int defaultPort, int reconnectionDelay);
~SocketAppenderSkeleton();
/**
Connects to remote server at <code>address</code> and <code>port</code>.
*/
SocketAppenderSkeleton(helpers::InetAddressPtr address, int port, int reconnectionDelay);
/**
Connects to remote server at <code>host</code> and <code>port</code>.
*/
SocketAppenderSkeleton(const LogString& host, int port, int reconnectionDelay);
/**
Connect to the specified <b>RemoteHost</b> and <b>Port</b>.
*/
void activateOptions(log4cxx::helpers::Pool& p);
void close();
/**
* This appender does not use a layout. Hence, this method
* returns <code>false</code>.
*
*/
bool requiresLayout() const
{ return false; }
/**
* The <b>RemoteHost</b> option takes a string value which should be
* the host name of the server where a
* Apache Chainsaw or compatible is running.
* */
inline void setRemoteHost(const LogString& host)
{ address = helpers::InetAddress::getByName(host);
remoteHost.assign(host); }
/**
Returns value of the <b>RemoteHost</b> option.
*/
inline const LogString& getRemoteHost() const
{ return remoteHost; }
/**
The <b>Port</b> option takes a positive integer representing
the port where the server is waiting for connections.
*/
void setPort(int port1)
{ this->port = port1; }
/**
Returns value of the <b>Port</b> option.
*/
int getPort() const
{ return port; }
/**
The <b>LocationInfo</b> option takes a boolean value. If true,
the information sent to the remote host will include location
information. By default no location information is sent to the server.
*/
void setLocationInfo(bool locationInfo1)
{ this->locationInfo = locationInfo1; }
/**
Returns value of the <b>LocationInfo</b> option.
*/
bool getLocationInfo() const
{ return locationInfo; }
/**
The <b>ReconnectionDelay</b> option takes a positive integer
representing the number of milliseconds to wait between each
failed connection attempt to the server. The default value of
this option is 30000 which corresponds to 30 seconds.
<p>Setting this option to zero turns off reconnection
capability.
*/
void setReconnectionDelay(int reconnectionDelay1)
{ this->reconnectionDelay = reconnectionDelay1; }
/**
Returns value of the <b>ReconnectionDelay</b> option.
*/
int getReconnectionDelay() const
{ return reconnectionDelay; }
void fireConnector();
void setOption(const LogString& option,
const LogString& value);
protected:
virtual void setSocket(log4cxx::helpers::SocketPtr& socket, log4cxx::helpers::Pool& p) = 0;
virtual void cleanUp(log4cxx::helpers::Pool& p) = 0;
virtual int getDefaultDelay() const = 0;
virtual int getDefaultPort() const = 0;
private:
void connect(log4cxx::helpers::Pool& p);
/**
The Connector will reconnect when the server becomes available
again. It does this by attempting to open a new connection every
<code>reconnectionDelay</code> milliseconds.
<p>It stops trying whenever a connection is established. It will
restart to try reconnect to the server when previpously open
connection is droppped.
*/
helpers::Thread thread;
static void* LOG4CXX_THREAD_FUNC monitor(apr_thread_t* thread, void* data);
SocketAppenderSkeleton(const SocketAppenderSkeleton&);
SocketAppenderSkeleton& operator=(const SocketAppenderSkeleton&);
}; // class SocketAppenderSkeleton
} // namespace net
} // namespace log4cxx
#endif // _LOG4CXX_NET_SOCKET_APPENDER_SKELETON_H
|