Apache log4cxx Version 0.13.0
Loading...
Searching...
No Matches
syslogappender.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_SYSLOG_APPENDER_H
19#define _LOG4CXX_NET_SYSLOG_APPENDER_H
20
23
24#if defined(_MSC_VER)
25 #pragma warning ( push )
26 #pragma warning ( disable: 4251 )
27#endif
28
29namespace log4cxx
30{
31namespace net
32{
46class LOG4CXX_EXPORT SyslogAppender : public AppenderSkeleton
47{
48 public:
54
55
56
58 SyslogAppender(const LayoutPtr& layout, int syslogFacility);
60 const LogString& syslogHost, int syslogFacility);
63 void close();
64
69 static LogString getFacilityString(int syslogFacility);
70
79 static int getFacility(const LogString& facilityName);
80
81 void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
82
87 void activateOptions(log4cxx::helpers::Pool& p);
88 void setOption(const LogString& option, const LogString& value);
89
94 virtual bool requiresLayout() const
95 {
96 return true;
97 }
98
105 void setSyslogHost(const LogString& syslogHost);
106
110 inline const LogString& getSyslogHost() const
111 {
112 return syslogHost;
113 }
114
123 void setFacility(const LogString& facilityName);
124
128 inline LogString getFacility() const
129 {
130 return getFacilityString(syslogFacility);
131 }
132
138 inline void setFacilityPrinting(bool facilityPrinting1)
139 {
140 this->facilityPrinting = facilityPrinting1;
141 }
142
146 inline bool getFacilityPrinting() const
147 {
148 return facilityPrinting;
149 }
150
151 inline void setMaxMessageLength(int maxMessageLength1)
152 {
153 maxMessageLength = maxMessageLength1;
154 }
155
156 inline int getMaxMessageLength() const
157 {
158 return maxMessageLength;
159 }
160
161 protected:
163
164 int syslogFacility; // Have LOG_USER as default
171 private:
173 SyslogAppender& operator=(const SyslogAppender&);
174}; // class SyslogAppender
176} // namespace net
177} // namespace log4cxx
178
179#if defined(_MSC_VER)
180 #pragma warning (pop)
181#endif
182
183#endif // _LOG4CXX_NET_SYSLOG_APPENDER_H
184
Implementation base class for all appenders.
Definition: appenderskeleton.h:46
SyslogWriter is a wrapper around the DatagramSocket class it writes text to the specified host on the...
Definition: syslogwriter.h:40
Use SyslogAppender to send log messages to a remote syslog daemon.
Definition: syslogappender.h:47
const LogString & getSyslogHost() const
Returns the value of the SyslogHost option.
Definition: syslogappender.h:110
void setMaxMessageLength(int maxMessageLength1)
Definition: syslogappender.h:151
int syslogFacility
Definition: syslogappender.h:164
LogString facilityStr
Definition: syslogappender.h:165
LogString syslogHost
Definition: syslogappender.h:168
int syslogHostPort
Definition: syslogappender.h:169
void setFacility(const LogString &facilityName)
Set the syslog facility.
void setFacilityPrinting(bool facilityPrinting1)
If the FacilityPrinting option is set to true, the printed message will include the facility name of ...
Definition: syslogappender.h:138
bool getFacilityPrinting() const
Returns the value of the FacilityPrinting option.
Definition: syslogappender.h:146
bool facilityPrinting
Definition: syslogappender.h:166
void setSyslogHost(const LogString &syslogHost)
The SyslogHost option is the name of the the syslog host where log output should go.
int getMaxMessageLength() const
Definition: syslogappender.h:156
LogString getFacility() const
Returns the value of the Facility option.
Definition: syslogappender.h:128
int maxMessageLength
Definition: syslogappender.h:170
helpers::SyslogWriter * sw
Definition: syslogappender.h:167
LOG4CXX_PTR_DEF(SMTPAppender)
Definition: messagehandler.h:23
std::basic_string< logchar > LogString
Definition: logstring.h:66
std::shared_ptr< Layout > LayoutPtr
Definition: appender.h:48
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:153
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:147
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:39
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:159
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:141