Apache Log4cxx  Version 1.7.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
24namespace LOG4CXX_NS
25{
26namespace net
27{
41class LOG4CXX_EXPORT SyslogAppender : public AppenderSkeleton
42{
43 public:
49
50
51
53 SyslogAppender(const LayoutPtr& layout, int syslogFacility);
55 const LogString& syslogHost, int syslogFacility);
58 void close() override;
59
64 static LogString getFacilityString(int syslogFacility);
65
74 static int getFacility(const LogString& facilityName);
75
76 void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
77
78#if LOG4CXX_ABI_VERSION <= 15
84 void activateOptions(helpers::Pool& p) override;
85#endif
101 void setOption(const LogString& option, const LogString& value) override;
102
107 bool requiresLayout() const override
108 {
109 return true;
110 }
111
118 void setSyslogHost(const LogString& syslogHost);
119
123 const LogString& getSyslogHost() const;
124
133 void setFacility(const LogString& facilityName);
134
139
145 void setFacilityPrinting(bool facilityPrinting1);
146
151
152 void setMaxMessageLength(int maxMessageLength1);
153
155
156 protected:
158
159 private:
160 struct SyslogAppenderPriv;
162 SyslogAppender& operator=(const SyslogAppender&);
163}; // class SyslogAppender
165} // namespace net
166} // namespace log4cxx
167
168#endif // _LOG4CXX_NET_SYSLOG_APPENDER_H
169
AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv)
Definition pool.h:33
Use SyslogAppender to send log messages to a remote syslog daemon.
Definition syslogappender.h:42
const LogString & getSyslogHost() const
Returns the value of the SyslogHost option.
void setMaxMessageLength(int maxMessageLength1)
bool requiresLayout() const override
The SyslogAppender requires a layout.
Definition syslogappender.h:107
void append(const spi::LoggingEventPtr &event, helpers::Pool &1) override
Subclasses of AppenderSkeleton must implement this method to perform actual logging.
void activateOptions(helpers::Pool &1) override
void setFacility(const LogString &facilityName)
Set the syslog facility.
void close() override
Release any resources held by this SyslogAppender.
void setFacilityPrinting(bool facilityPrinting1)
If the FacilityPrinting option is set to true, the printed message will include the facility name of ...
bool getFacilityPrinting() const
Returns the value of the FacilityPrinting option.
void setOption(const LogString &option, const LogString &value) override
Set option to value.
void setSyslogHost(const LogString &syslogHost)
The SyslogHost option is the name of the the syslog host where log output should go.
static LogString getFacilityString(int syslogFacility)
Returns the specified syslog facility as a lower-case String, e.g.
LogString getFacility() const
Returns the value of the Facility option.
static int getFacility(const LogString &facilityName)
Returns the integer value corresponding to the named syslog facility, or -1 if it couldn't be recogni...
Definition propertysetter.h:27
LOG4CXX_PTR_DEF(SMTPAppender)
Definition appender.h:30
std::basic_string< logchar > LogString
Definition logstring.h:60
std::shared_ptr< Layout > LayoutPtr
Definition appender.h:42
#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