|
Apache Log4cxx
Version 2.0.0
|
A special version of the RollingFileAppender that acts properly with multiple processes. More...
#include <multiprocessrollingfileappender.h>
Public Member Functions | |
| MultiprocessRollingFileAppender () | |
| An unconfigured Appender. | |
| void | activateOptions () override |
| Derived appenders should override this method if option structure requires it. | |
| Public Member Functions inherited from log4cxx::rolling::RollingFileAppender | |
| RollingFileAppender () | |
| An unconfigured Appender. | |
| int | getMaxBackupIndex () const |
| Returns the value of the MaxBackupIndex option. | |
| size_t | getMaximumFileSize () const |
| Get the maximum size that the output file is allowed to reach before being rolled over to backup files. | |
| void | setMaxBackupIndex (int maxBackupIndex) |
| Set the maximum number of backup files to keep around. | |
| void | setMaxFileSize (const LogString &value) |
| Set the maximum size that the output file is allowed to reach before being rolled over to backup files. | |
| void | setMaximumFileSize (size_t value) |
| void | setDatePattern (const LogString &pattern) |
The DatePattern takes a string in the same format as expected by SimpleDateFormat. | |
| LogString | makeFileNamePattern (const LogString &datePattern) |
| void | setOption (const LogString &option, const LogString &value) override |
Override this method to set option to value. | |
| void | activateOptions () override |
| Derived appenders should override this method if option structure requires it. | |
| bool | rollover () |
| Implements the configured roll over behaviour. | |
| RollingPolicyPtr | getRollingPolicy () const |
| The policy that implements the scheme for rolling over a log file. | |
| TriggeringPolicyPtr | getTriggeringPolicy () const |
| The policy that determine when to trigger a log file rollover. | |
| void | setRollingPolicy (const RollingPolicyPtr &policy) |
Use policy as the scheme for rolling over log files. | |
| void | setTriggeringPolicy (const TriggeringPolicyPtr &policy) |
Use policy to determine when to trigger a log file rollover. | |
| size_t | getFileLength () const |
| Get byte length of current active log file. | |
| void | activateOptions (helpers::Pool &) |
| Public Member Functions inherited from log4cxx::FileAppender | |
| FileAppender () | |
| An unconfigured Appender. | |
| FileAppender (const LayoutPtr &layout, const LogString &fileName, bool appendToExistingFile=true, bool useBufferedOutput=false, int bufferByteCount=DefaultBufferedByteCount) | |
Open fileName and prepare to write spi::LoggingEvent messages formatted by layout. | |
| ~FileAppender () | |
| void | setFile (const LogString &file) |
| The File property takes a string value which should be the name of the file to append to. | |
| bool | getAppend () const |
| Returns the value of the Append option. | |
| LogString | getFile () const |
| Returns the value of the File option. | |
| bool | getBufferedIO () const |
| Get the value of the BufferedIO option. | |
| size_t | getBufferSize () const |
| Get the size of the IO buffer. | |
| int | getBufferedSeconds () const |
Get the number of seconds between file writes when the BufferedIO option is true. | |
| void | setAppend (bool newValue) |
Set file open mode to newValue. | |
| void | setBufferedIO (bool newValue) |
Set buffered output behavior to newValue. | |
| void | setBufferSize (size_t newValue) |
Use newValue, a value up to 2^31, as the size of the output buffer. | |
| void | setBufferedSeconds (int newValue) |
Flush the output buffer every newValue seconds. | |
| void | setLazyFileCreation (bool newValue) |
Create the file when the first message is written (rather than in activateOptions) if newValue is true, so that no empty file is created when nothing is logged. | |
| bool | getLazyFileCreation () const |
| Get the value of the LazyFileCreation option. | |
| Public Member Functions inherited from log4cxx::WriterAppender | |
| 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 | |
| void | subAppend (const spi::LoggingEventPtr &event) override |
| Rollover the file if required before calling WriterAppender::subAppend. | |
| Protected Member Functions inherited from log4cxx::rolling::RollingFileAppender | |
| RollingFileAppender (std::unique_ptr< RollingFileAppenderPriv > priv) | |
An appender that uses the sub-classed priv instance data. | |
| void | subAppend (const spi::LoggingEventPtr &event) override |
| Rollover the file if required before calling WriterAppender::subAppend. | |
| Protected Member Functions inherited from log4cxx::FileAppender | |
| FileAppender (std::unique_ptr< FileAppenderPriv > priv) | |
| Protected Member Functions inherited from log4cxx::WriterAppender | |
| 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. | |
| 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? | |
Additional Inherited Members | |
| Static Public Member Functions inherited from log4cxx::FileAppender | |
| static LogString | stripDuplicateBackslashes (const LogString &name) |
| Replaces double backslashes with single backslashes for compatibility with paths from earlier XML configurations files. | |
| Static Public Attributes inherited from log4cxx::FileAppender | |
| static const size_t | MaxBufferedByteCount = 2LL * 1024 * 1024 * 1024 |
| static const int | DefaultBufferedByteCount = 8 * 1024 |
A special version of the RollingFileAppender that acts properly with multiple processes.
Coordinating with other processes adds significant overhead compared to RollingFileAppender. Benchmarks show the overhead of this appender is more than 3 and 10 times the overhead of RollingFileAppender on Linux and Windows respectively.
Note: Do not set the option Append to false. Rolling over files is only relevant when you are appending.
| log4cxx::rolling::MultiprocessRollingFileAppender::MultiprocessRollingFileAppender | ( | ) |
An unconfigured Appender.
|
overridevirtual |
Derived appenders should override this method if option structure requires it.
Reimplemented from log4cxx::FileAppender.
|
overrideprotectedvirtual |
Rollover the file if required before calling WriterAppender::subAppend.
Reimplemented from log4cxx::WriterAppender.