Apache Log4cxx Version 1.1.0
Loading...
Searching...
No Matches
appender.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_APPENDER_H
19#define _LOG4CXX_APPENDER_H
20
23#include <vector>
24
25
26namespace log4cxx
27{
28// Forward declarations
29namespace spi
30{
31class LoggingEvent;
32typedef std::shared_ptr<LoggingEvent> LoggingEventPtr;
33
34class Filter;
35typedef std::shared_ptr<Filter> FilterPtr;
36
37class ErrorHandler;
38typedef std::shared_ptr<ErrorHandler> ErrorHandlerPtr;
39}
40
41class Layout;
42typedef std::shared_ptr<Layout> LayoutPtr;
43
44
49class LOG4CXX_EXPORT Appender :
50 public virtual spi::OptionHandler
51{
52 public:
54
55 virtual ~Appender() {}
56
60 virtual void addFilter(const spi::FilterPtr newFilter) = 0;
61
68 virtual spi::FilterPtr getFilter() const = 0;
69
73 virtual void clearFilters() = 0;
74
80 virtual void close() = 0;
81
87 virtual void doAppend(const spi::LoggingEventPtr& event,
88 log4cxx::helpers::Pool& pool) = 0;
89
90
95 virtual LogString getName() const = 0;
96
97
101 virtual void setLayout(const LayoutPtr layout) = 0;
102
106 virtual LayoutPtr getLayout() const = 0;
107
108
113 virtual void setName(const LogString& name) = 0;
114
129 virtual bool requiresLayout() const = 0;
130};
131
134
135}
136
137#endif //_LOG4CXX_APPENDER_H
Implement this interface for your own strategies for outputting log statements.
Definition: appender.h:51
virtual void doAppend(const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool)=0
Log in Appender specific way.
virtual LogString getName() const =0
Get the name of this appender.
virtual void addFilter(const spi::FilterPtr newFilter)=0
Add a filter to the end of the filter list.
virtual spi::FilterPtr getFilter() const =0
Returns the head Filter.
virtual bool requiresLayout() const =0
Configurators call this method to determine if the appender requires a layout.
virtual void close()=0
Release any resources allocated within the appender such as file handles, network connections,...
virtual void clearFilters()=0
Clear the list of filters by removing all the filters in it.
virtual LayoutPtr getLayout() const =0
Returns this appenders layout.
virtual void setLayout(const LayoutPtr layout)=0
Set the Layout for this appender.
virtual void setName(const LogString &name)=0
Set the name of this appender.
Extend this abstract class to create your own log layout format.
Definition: layout.h:34
Definition: pool.h:33
Appenders may delegate their error handling to ErrorHandlers.
Definition: errorhandler.h:59
Users should extend this class to implement customized logging event filtering.
Definition: filter.h:68
The internal representation of logging events.
Definition: loggingevent.h:51
A string based interface to configure package components.
Definition: optionhandler.h:35
std::shared_ptr< ErrorHandler > ErrorHandlerPtr
Definition: appender.h:38
std::shared_ptr< Filter > FilterPtr
Definition: appender.h:35
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:32
Definition: configuration.h:25
LOG4CXX_LIST_DEF(AppenderList, AppenderPtr)
std::basic_string< logchar > LogString
Definition: logstring.h:60
std::shared_ptr< Layout > LayoutPtr
Definition: appender.h:42
LOG4CXX_PTR_DEF(Appender)
std::shared_ptr< Appender > AppenderPtr
Definition: basicconfigurator.h:29
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition: object.h:38