|
Apache Log4cxx
Version 2.0.0
|
An abstract base for an appender that writes to a character stream. More...
#include <writerappender.h>
Public Member Functions | |
| WriterAppender () | |
| An uninitialised Appender. | |
| ~WriterAppender () | |
| void | activateOptions () override |
| Derived appenders should override this method if option structure requires it. | |
| void | setImmediateFlush (bool value) |
If the ImmediateFlush option is set to true, the appender will flush at the end of each write. | |
| bool | getImmediateFlush () const |
| Returns value of the ImmediateFlush option. | |
| void | append (const spi::LoggingEventPtr &event) override |
| This method is called by the AppenderSkeleton::doAppend method. | |
| void | close () override |
| Close this appender instance. | |
| LogString | getEncoding () const |
| The current encoding value. | |
| void | setEncoding (const LogString &value) |
Set the encoding to value. | |
| void | setOption (const LogString &option, const LogString &value) override |
Set option to value. | |
| bool | requiresLayout () const override |
| Configurators call this method to determine if the appender requires a layout. | |
| void | activateOptions (helpers::Pool &) |
| Public Member Functions inherited from log4cxx::AppenderSkeleton | |
| AppenderSkeleton () | |
| AppenderSkeleton (const LayoutPtr &layout) | |
| virtual | ~AppenderSkeleton () |
| void | addFilter (const spi::FilterPtr &newFilter) override |
| Add a filter to end of the filter list. | |
| void | clearFilters () override |
| Clear the filters chain. | |
| const spi::ErrorHandlerPtr | getErrorHandler () const |
| Return the currently set spi::ErrorHandler for this Appender. | |
| spi::FilterPtr | getFilter () const override |
| Returns the head Filter. | |
| const spi::FilterPtr | getFirstFilter () const |
| Return the first filter in the filter chain for this Appender. | |
| LayoutPtr | getLayout () const override |
| Returns the layout of this appender. | |
| LogString | getName () const override |
| Returns the name of this Appender. | |
| const LevelPtr | getThreshold () const |
| Returns this appenders threshold level. | |
| bool | isAsSevereAsThreshold (const LevelPtr &level) const |
| Check whether the message level is below the appender's threshold. | |
| void | doAppend (const spi::LoggingEventPtr &event) override |
| Call AppenderSkeleton::doAppendImpl after acquiring a lock that prevents other threads from concurrently executing AppenderSkeleton::doAppendImpl. | |
| void | setErrorHandler (const spi::ErrorHandlerPtr &eh) |
Set the ErrorHandler for this Appender. | |
| void | setLayout (const LayoutPtr &layout1) override |
| Set the layout for this appender. | |
| void | setName (const LogString &name1) override |
| Set the name of this Appender. | |
| void | setThreshold (const LevelPtr &threshold) |
| Set the threshold level. | |
| void | activateOptions (helpers::Pool &) |
| Public Member Functions inherited from log4cxx::Appender | |
| virtual | ~Appender () |
| void | doAppend (const spi::LoggingEventPtr &event, helpers::Pool &pool) |
| Public Member Functions inherited from log4cxx::spi::OptionHandler | |
| virtual | ~OptionHandler () |
| void | activateOptions (helpers::Pool &) |
| Public Member Functions inherited from log4cxx::helpers::Object | |
| virtual | ~Object () |
| virtual const helpers::Class & | getClass () const =0 |
| virtual bool | instanceof (const Class &clazz) const =0 |
| virtual const void * | cast (const Class &clazz) const =0 |
Protected Member Functions | |
| WriterAppender (const LayoutPtr &layout, const helpers::WriterPtr &writer=helpers::WriterPtr()) | |
An appender that writes spi::LoggingEvent messages formatted by layout to the character stream attached to writer. | |
| WriterAppender (std::unique_ptr< WriterAppenderPriv > priv) | |
An appender that uses the sub-classed priv instance data. | |
| virtual bool | checkEntryConditions () const |
| This method determines if there is a sense in attempting to append. | |
| virtual void | subAppend (const spi::LoggingEventPtr &event) |
Format event as a message and write it to the character stream. | |
| Protected Member Functions inherited from log4cxx::AppenderSkeleton | |
| AppenderSkeleton (LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv) | |
| void | doAppendImpl (const spi::LoggingEventPtr &event) |
Compare event level against the appender threshold and check that event is accepted. | |
| bool | isAccepted (const spi::LoggingEventPtr &event) const |
Does no attached filter deny event or does an attached filter accept event? | |
An abstract base for an appender that writes to a character stream.
| log4cxx::WriterAppender::WriterAppender | ( | ) |
An uninitialised Appender.
|
protected |
An appender that writes spi::LoggingEvent messages formatted by layout to the character stream attached to writer.
|
protected |
An appender that uses the sub-classed priv instance data.
| log4cxx::WriterAppender::~WriterAppender | ( | ) |
|
overridevirtual |
Derived appenders should override this method if option structure requires it.
Reimplemented from log4cxx::AppenderSkeleton.
|
overridevirtual |
This method is called by the AppenderSkeleton::doAppend method.
If the output stream exists and is writable then write a log statement to the output stream. Otherwise, write a single warning message to stderr.
The format of the output will depend on this appender's layout.
Implements log4cxx::AppenderSkeleton.
|
protectedvirtual |
This method determines if there is a sense in attempting to append.
It checks whether there is a set output target and also if there is a set layout. If these checks fail, then the boolean value false is returned.
|
overridevirtual |
Close this appender instance.
The underlying stream or writer is also closed.
Closed appenders cannot be reused.
Implements log4cxx::Appender.
| LogString log4cxx::WriterAppender::getEncoding | ( | ) | const |
The current encoding value.
| bool log4cxx::WriterAppender::getImmediateFlush | ( | ) | const |
Returns value of the ImmediateFlush option.
|
overridevirtual |
Configurators call this method to determine if the appender requires a layout.
If this method returns true, meaning that layout is required, then the configurator will configure an layout using the configuration information at its disposal. If this method returns false, meaning that a layout is not required, then layout configuration will be skipped even if there is available layout configuration information at the disposal of the configurator..
In the rather exceptional case, where the appender implementation admits a layout but can also work without it, then the appender should return true.
Implements log4cxx::Appender.
| void log4cxx::WriterAppender::setEncoding | ( | const LogString & | value | ) |
Set the encoding to value.
| void log4cxx::WriterAppender::setImmediateFlush | ( | bool | value | ) |
If the ImmediateFlush option is set to true, the appender will flush at the end of each write.
This is the default behavior. If the option is set to false, then the underlying stream can defer writing to physical medium to a later time.
Avoiding the flush operation at the end of each append results in a performance gain of 10 to 20 percent. However, there is safety tradeoff involved in skipping flushing. Indeed, when flushing is skipped, then it is likely that the last few log events will not be recorded on disk when the application exits. This is a high price to pay even for a 20% performance gain.
|
overridevirtual |
Set option to value.
| Supported options | Supported values | Default value |
|---|---|---|
| Encoding | C,UTF-8,UTF-16,UTF-16BE,UTF-16LE,646,US-ASCII,ISO646-US,ANSI_X3.4-1968,ISO-8859-1,ISO-LATIN-1 | UTF-8 |
Reimplemented from log4cxx::AppenderSkeleton.
|
protectedvirtual |
Format event as a message and write it to the character stream.
Reimplemented in log4cxx::rolling::MultiprocessRollingFileAppender, and log4cxx::rolling::RollingFileAppender.