Apache Log4cxx  Version 1.5.0
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 namespace LOG4CXX_NS
25 {
26 namespace net
27 {
41 class LOG4CXX_EXPORT SyslogAppender : public AppenderSkeleton
42 {
43  public:
49 
50 
51 
53  SyslogAppender(const LayoutPtr& layout, int syslogFacility);
54  SyslogAppender(const LayoutPtr& layout,
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 
83  void activateOptions(helpers::Pool& p) override;
84 
100  void setOption(const LogString& option, const LogString& value) override;
101 
106  bool requiresLayout() const override
107  {
108  return true;
109  }
110 
117  void setSyslogHost(const LogString& syslogHost);
118 
122  const LogString& getSyslogHost() const;
123 
132  void setFacility(const LogString& facilityName);
133 
138 
144  void setFacilityPrinting(bool facilityPrinting1);
145 
149  bool getFacilityPrinting() const;
150 
151  void setMaxMessageLength(int maxMessageLength1);
152 
153  int getMaxMessageLength() const;
154 
155  protected:
157 
158  private:
159  struct SyslogAppenderPriv;
161  SyslogAppender& operator=(const SyslogAppender&);
162 }; // class SyslogAppender
164 } // namespace net
165 } // namespace log4cxx
166 
167 #endif // _LOG4CXX_NET_SYSLOG_APPENDER_H
168 
log4cxx::net::SyslogAppender::setSyslogHost
void setSyslogHost(const LogString &syslogHost)
The SyslogHost option is the name of the the syslog host where log output should go.
log4cxx::net::LOG4CXX_PTR_DEF
LOG4CXX_PTR_DEF(SyslogAppender)
log4cxx::LogString
std::basic_string< logchar > LogString
Definition: logstring.h:60
log4cxx::net::SyslogAppender::initSyslogFacilityStr
void initSyslogFacilityStr()
log4cxx::net::SyslogAppender
Use SyslogAppender to send log messages to a remote syslog daemon.
Definition: syslogappender.h:42
log4cxx::net::SyslogAppender::getFacilityPrinting
bool getFacilityPrinting() const
Returns the value of the FacilityPrinting option.
BEGIN_LOG4CXX_CAST_MAP
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:146
log4cxx::net::SyslogAppender::getSyslogHost
const LogString & getSyslogHost() const
Returns the value of the SyslogHost option.
DECLARE_LOG4CXX_OBJECT
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:43
END_LOG4CXX_CAST_MAP
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:152
log4cxx::spi::LoggingEventPtr
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:31
log4cxx::net::SyslogAppender::getFacility
LogString getFacility() const
Returns the value of the Facility option.
log4cxx::LayoutPtr
std::shared_ptr< Layout > LayoutPtr
Definition: appender.h:41
log4cxx::net::SyslogAppender::getMaxMessageLength
int getMaxMessageLength() const
log4cxx::net::SyslogAppender::setMaxMessageLength
void setMaxMessageLength(int maxMessageLength1)
log4cxx::AppenderSkeleton
Implementation base class for all appenders.
Definition: appenderskeleton.h:41
appenderskeleton.h
LOG4CXX_CAST_ENTRY_CHAIN
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:164
log4cxx::net::SyslogAppender::setFacility
void setFacility(const LogString &facilityName)
Set the syslog facility.
log4cxx::net::SyslogAppender::setFacilityPrinting
void setFacilityPrinting(bool facilityPrinting1)
If the FacilityPrinting option is set to true, the printed message will include the facility name of ...
syslogwriter.h
LOG4CXX_CAST_ENTRY
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:158