Apache Log4cxx  Version 1.7.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#if LOG4CXX_ABI_VERSION <= 15
51 : public virtual spi::OptionHandler
52#else
53 : public spi::OptionHandler
54#endif
55{
56 public:
58
59 virtual ~Appender() {}
60
64 virtual void addFilter(const spi::FilterPtr newFilter) = 0;
65
72 virtual spi::FilterPtr getFilter() const = 0;
73
77 virtual void clearFilters() = 0;
78
84 virtual void close() = 0;
85
91 virtual void doAppend(const spi::LoggingEventPtr& event,
92 LOG4CXX_NS::helpers::Pool& pool) = 0;
93
94
99 virtual LogString getName() const = 0;
100
101
105 virtual void setLayout(const LayoutPtr layout) = 0;
106
110 virtual LayoutPtr getLayout() const = 0;
111
112
117 virtual void setName(const LogString& name) = 0;
118
133 virtual bool requiresLayout() const = 0;
134};
135
138
139}
140
141#endif //_LOG4CXX_APPENDER_H
Implement this interface for your own strategies for outputting log statements.
Definition appender.h:55
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:38
Appenders may delegate their error handling to ErrorHandlers.
Definition errorhandler.h:64
Users should extend this class to implement customized logging event filtering.
Definition filter.h:73
The data recorded for each logging request.
Definition loggingevent.h:47
A string based interface to configure package components.
Definition optionhandler.h:35
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: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:37