|
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. | |
| 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 |
Override this method to set option to value. | |
| void | activateOptions (helpers::Pool &) |
| Public Member Functions inherited from log4cxx::AppenderSkeleton | |
| AppenderSkeleton (const LayoutPtr &layout={}) | |
| virtual | ~AppenderSkeleton () |
| void | addFilter (const spi::FilterPtr &newFilter) override |
Add newFilter to end of the spi::Filter chain. | |
| void | clearFilters () override |
| Clear the spi::Filter chain. | |
| void | close () override |
| Release any resources allocated within the appender such as file handles, network connections, etc. | |
| const spi::ErrorHandlerPtr | getErrorHandler () const |
| The currently set spi::ErrorHandler for this Appender. | |
| spi::FilterPtr | getFilter () const override |
| The first spi::Filter in the filter chain for this Appender. | |
| const spi::FilterPtr | getFirstFilter () const |
| The first spi::Filter in the filter chain for this Appender. | |
| LayoutPtr | getLayout () const override |
| The currently set Layout for this appender. | |
| LogString | getName () const override |
| The name of this Appender. | |
| const LevelPtr | getThreshold () const |
| This appender's current threshold level. | |
| bool | isAsSevereAsThreshold (const LevelPtr &level) const |
Is level greater than or equal to this appender's threshold? | |
| void | doAppend (const spi::LoggingEventPtr &event) override |
| Call doAppendImpl after acquiring a lock that prevents other threads from concurrently executing doAppendImpl. | |
| void | setErrorHandler (const spi::ErrorHandlerPtr &newValue) |
Use newValue as the spi::ErrorHandler for this Appender. | |
| void | setLayout (const LayoutPtr &newValue) override |
Use newValue as the layout for this appender. | |
| void | setName (const LogString &newValue) override |
Use newValue for the name of this Appender. | |
| void | setThreshold (const LevelPtr &newValue) |
Use newValue as this appender's threshold level. | |
| void | activateOptions (helpers::Pool &) |
| Public Member Functions inherited from log4cxx::Appender | |
| virtual | ~Appender () |
| void | doAppend (const spi::LoggingEventPtr &event, helpers::Pool &pool) |
| virtual bool | requiresLayout () const |
| 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) |
Call the AppenderSkeleton::append method if the level of event is not lower than this appender's threshold and no attached spi::Filter indicates event is rejected. | |
| 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.
| LogString log4cxx::WriterAppender::getEncoding | ( | ) | const |
The current encoding value.
| bool log4cxx::WriterAppender::getImmediateFlush | ( | ) | const |
Returns value of the ImmediateFlush option.
| 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 |
Override this method to 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.