Apache Log4cxx
Version 2.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
writerappender.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_WRITER_APPENDER_H
19
#define _LOG4CXX_WRITER_APPENDER_H
20
21
#include <
log4cxx/appenderskeleton.h
>
22
#include <
log4cxx/helpers/outputstreamwriter.h
>
23
#include <atomic>
24
25
namespace
LOG4CXX_NS
26
{
27
31
class
LOG4CXX_EXPORT
WriterAppender
:
public
AppenderSkeleton
32
{
33
protected
:
34
struct
WriterAppenderPriv;
35
public
:
36
DECLARE_ABSTRACT_LOG4CXX_OBJECT
(
WriterAppender
)
37
BEGIN_LOG4CXX_CAST_MAP
()
38
LOG4CXX_CAST_ENTRY
(
WriterAppender
)
39
LOG4CXX_CAST_ENTRY_CHAIN
(
AppenderSkeleton
)
40
END_LOG4CXX_CAST_MAP
()
41
42
45
WriterAppender
();
46
protected:
51
WriterAppender
(const
LayoutPtr
& layout, const
helpers
::WriterPtr& writer =
helpers
::WriterPtr());
55
WriterAppender
(std::unique_ptr<WriterAppenderPriv> priv);
56
57
public:
58
~
WriterAppender
();
59
60
using
AppenderSkeleton
::
activateOptions
;
65
void
activateOptions
( ) override;
66
81
void
setImmediateFlush
(
bool
value);
85
bool
getImmediateFlush
() const;
86
99
void
append
( const
spi
::LoggingEventPtr& event ) override;
100
101
102
protected:
109
virtual
bool
checkEntryConditions
() const;
110
111
112
public:
119
void
close
() override;
120
121
public:
127
LogString
getEncoding
() const;
133
void
setEncoding
(const
LogString
& value);
134
144
void
setOption
(const
LogString
& option, const
LogString
& value) override;
145
146
147
bool
requiresLayout
() const override;
148
149
protected:
153
virtual
void
subAppend
( const
spi
::LoggingEventPtr& event );
154
155
156
private:
157
//
158
// prevent copy and assignment
159
WriterAppender
(const
WriterAppender
&);
160
WriterAppender
& operator=(const
WriterAppender
&);
161
};
162
163
LOG4CXX_PTR_DEF
(
WriterAppender
);
164
165
}
//namespace log4cxx
166
167
#endif
//_LOG4CXX_WRITER_APPENDER_H
appenderskeleton.h
log4cxx::AppenderSkeleton::AppenderSkeleton
AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv)
log4cxx::WriterAppender
An abstract base for an appender that writes to a character stream.
Definition
writerappender.h:32
log4cxx::WriterAppender::activateOptions
void activateOptions() override
Derived appenders should override this method if option structure requires it.
log4cxx::WriterAppender::getEncoding
LogString getEncoding() const
The current encoding value.
log4cxx::WriterAppender::setOption
void setOption(const LogString &option, const LogString &value) override
Set option to value.
log4cxx::WriterAppender::subAppend
virtual void subAppend(const spi::LoggingEventPtr &event)
Format event as a message and write it to the character stream.
log4cxx::WriterAppender::setImmediateFlush
void setImmediateFlush(bool value)
If the ImmediateFlush option is set to true, the appender will flush at the end of each write.
log4cxx::WriterAppender::append
void append(const spi::LoggingEventPtr &event) override
This method is called by the AppenderSkeleton::doAppend method.
log4cxx::WriterAppender::requiresLayout
bool requiresLayout() const override
Configurators call this method to determine if the appender requires a layout.
log4cxx::WriterAppender::getImmediateFlush
bool getImmediateFlush() const
Returns value of the ImmediateFlush option.
log4cxx::WriterAppender::close
void close() override
Close this appender instance.
log4cxx::WriterAppender::checkEntryConditions
virtual bool checkEntryConditions() const
This method determines if there is a sense in attempting to append.
log4cxx::WriterAppender::setEncoding
void setEncoding(const LogString &value)
Set the encoding to value.
log4cxx::WriterAppender::WriterAppender
WriterAppender()
An uninitialised Appender.
log4cxx::helpers
Definition
propertysetter.h:27
log4cxx::spi
Definition
appender.h:30
log4cxx::LogString
std::basic_string< logchar > LogString
Definition
logstring.h:51
log4cxx::LayoutPtr
std::shared_ptr< Layout > LayoutPtr
Definition
appender.h:42
log4cxx::LOG4CXX_PTR_DEF
LOG4CXX_PTR_DEF(Appender)
LOG4CXX_CAST_ENTRY
#define LOG4CXX_CAST_ENTRY(Interface)
Definition
object.h:153
DECLARE_ABSTRACT_LOG4CXX_OBJECT
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition
object.h:37
END_LOG4CXX_CAST_MAP
#define END_LOG4CXX_CAST_MAP()
Definition
object.h:147
LOG4CXX_CAST_ENTRY_CHAIN
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition
object.h:159
BEGIN_LOG4CXX_CAST_MAP
#define BEGIN_LOG4CXX_CAST_MAP()
Definition
object.h:141
outputstreamwriter.h
src
main
include
log4cxx
writerappender.h
Generated by
1.18.0 on
SITE_PUBLISHED_DATE
Copyright © 2017-2026
Apache Software Foundation
. Apache, Chainsaw, log4cxx, Log4j, Log4net, log4php and the Apache logo are
trademarks or registered trademarks
of The Apache Software Foundation.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Privacy Policy
.