Apache Log4cxx  Version 2.0.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_NS
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 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
79 virtual void close() = 0;
80
86 virtual void doAppend(const spi::LoggingEventPtr& event) = 0;
90 [[deprecated("Use doAppend() without a Pool parameter instead")]]
91 void doAppend(const spi::LoggingEventPtr& event, helpers::Pool& pool);
92
97 virtual LogString getName() const = 0;
98
99
103 virtual void setLayout(const LayoutPtr& layout) = 0;
104
108 virtual LayoutPtr getLayout() const = 0;
109
110
115 virtual void setName(const LogString& name) = 0;
116
120 [[deprecated("This method is no longer used by Log4cxx configurators")]]
121 virtual bool requiresLayout() const;
122};
123
126
127}
128
129#endif //_LOG4CXX_APPENDER_H
Implement this interface for your own strategies for outputting log statements.
Definition appender.h:51
void doAppend(const spi::LoggingEventPtr &event, helpers::Pool &pool)
virtual LogString getName() const =0
Get the name of this appender.
virtual spi::FilterPtr getFilter() const =0
Returns the head Filter.
virtual void doAppend(const spi::LoggingEventPtr &event)=0
Add a formatted equivalent of event to the output.
virtual void close()=0
Release any resources allocated within the appender such as file handles, network connections,...
virtual void addFilter(const spi::FilterPtr &newFilter)=0
Add a filter to the end of the filter list.
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 bool requiresLayout() const
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:33
Definition pool.h:33
Appenders may delegate their error handling to ErrorHandlers.
Definition errorhandler.h:55
Users should extend this class to implement customized logging event filtering.
Definition filter.h:69
The data recorded for each logging request.
Definition loggingevent.h:47
A string based interface to configure package components.
Definition optionhandler.h:37
Definition appender.h:30
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
LOG4CXX_LIST_DEF(AppenderList, AppenderPtr)
std::basic_string< logchar > LogString
Definition logstring.h:51
std::shared_ptr< Appender > AppenderPtr
Definition basicconfigurator.h:29
std::shared_ptr< Layout > LayoutPtr
Definition appender.h:42
LOG4CXX_PTR_DEF(Appender)
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition object.h:37