A special version of the RollingFileAppender that acts properly with multiple processes.
More...
#include <multiprocessrollingfileappender.h>
Inheritance diagram for log4cxx::rolling::MultiprocessRollingFileAppender:
Activate the options that were previously set with calls to option setters.
Implements the usual roll over behaviour.
Returns the value of the MaxBackupIndex option.
Get the maximum size that the output file is allowed to reach before being rolled over to backup files.
Set the maximum number of backup files to keep around.
Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
The
DatePattern takes a string in the same format as expected by
SimpleDateFormat .
Set option to value.
Activate the options that were previously set with calls to option setters.
Implements the configured roll over behaviour.
The policy that implements the scheme for rolling over a log file.
The policy that determine when to trigger a log file rollover.
Use policy as the scheme for rolling over log files.
Use policy to determine when to trigger a log file rollover.
Close appender.
Get byte length of current active log file.
Increments estimated byte length of current active log file.
The default constructor does not do anything.
Instantiate a
FileAppender and open the file designated by
filename.
Instantiate a
FileAppender and open the file designated by
filename.
Instantiate a
FileAppender and open the file designated by
filename.
The
File property takes a string value which should be the name of the file to append to.
Returns the value of the Append option.
Returns the value of the
File option.
Activate the options that were previously set with calls to option setters.
Set option to value.
Get the value of the BufferedIO option.
Get the size of the IO buffer.
Get the number of seconds between file writes when the BufferedIO option is true.
Set file open mode to newValue.
Set buffered output behavior to newValue.
Use newValue as the size of the output buffer.
Flush the output buffer every newValue seconds.
This default constructor does nothing.
Derived appenders should override this method if option structure requires it.
If the ImmediateFlush option is set to true, the appender will flush at the end of each write.
Returns value of the ImmediateFlush option.
Close this appender instance.
The current encoding value.
Set the encoding to value.
Set option to value.
void
setWriter (const helpers::WriterPtr &writer)
Configurators call this method to determine if the appender requires a layout.
Finalize this appender by calling the derived class' close method.
Activate the options that were previously set with calls to option setters.
Set option to value.
Add a filter to end of the filter list.
Clear the filters chain.
Returns the head Filter.
Return the first filter in the filter chain for this
Appender.
Returns the layout of this appender.
Returns this appenders threshold level.
Check whether the message level is below the appender's threshold.
This method performs threshold checks and invokes filters before delegating actual logging to the subclasses specific
AppenderSkeleton::append method.
Set the layout for this appender.
Set the threshold level.
Add a filter to the end of the filter list.
Returns the head Filter.
Clear the list of filters by removing all the filters in it.
Release any resources allocated within the appender such as file handles, network connections, etc.
Get the name of this appender.
Set the
Layout for this appender.
Returns this appenders layout.
Set the name of this appender.
Configurators call this method to determine if the appender requires a layout.
Activate the options that were previously set with calls to option setters.
Set option to value.
virtual const void *
cast (const
Class &clazz) const =0
Protected Member Functions
Actual writing occurs here.
Returns an OutputStreamWriter when passed an OutputStream.
Actual writing occurs here.
Returns an OutputStreamWriter when passed an OutputStream.
Sets and opens the file where the log output will go.
This method determines if there is a sense in attempting to append.
Returns an OutputStreamWriter when passed an OutputStream.
Actual writing occurs here.
Set the writer.
Subclasses of
AppenderSkeleton should implement this method to perform actual logging.
Additional Inherited Members
Replaces double backslashes with single backslashes for compatibility with paths from earlier XML configurations files.
Detailed Description
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.
Constructor & Destructor Documentation
◆ MultiprocessRollingFileAppender()
log4cxx::rolling::MultiprocessRollingFileAppender::MultiprocessRollingFileAppender
(
)
Member Function Documentation
◆ activateOptions()
void log4cxx::rolling::MultiprocessRollingFileAppender::activateOptions
(
helpers::Pool &
pool )
overridevirtual
◆ createWriter()
helpers::WriterPtr log4cxx::rolling::MultiprocessRollingFileAppender::createWriter
(
LOG4CXX_16_CONST helpers::OutputStreamPtr &
os )
overrideprotectedvirtual
Returns an OutputStreamWriter when passed an OutputStream.
The encoding used will depend on the value of the encoding property. If the encoding value is specified incorrectly the writer will be opened using the default system encoding (an error message will be printed to the loglog.
- Parameters
-
os output stream, may not be null.
- Returns
- new writer.
Reimplemented from log4cxx::WriterAppender.
◆ rollover()
bool log4cxx::rolling::MultiprocessRollingFileAppender::rollover
(
helpers::Pool &
p )
Implements the usual roll over behaviour.
If MaxBackupIndex is positive, then files {File.1, ..., File.MaxBackupIndex -1} are renamed to {File.2, ..., File.MaxBackupIndex}. Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.
If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.
◆ subAppend()
void log4cxx::rolling::MultiprocessRollingFileAppender::subAppend
(
const
spi::LoggingEventPtr &
event,
)
overrideprotectedvirtual
The documentation for this class was generated from the following file: