log4shib::FileAppender(3)
πΎ log4shib::FileAppender β the manual page, bestie edition π
okay so this is the log4shib::FileAppender(3) page from the log4shib Library Functions Manual, and it's literally the appender that writes your logs to a file. yes, that's the whole vibe. let's get into it β¨
πΈ NAME πΈ
log4shib::FileAppender β it's a class! it appends. to files. iykyk π
β¨ SYNOPSIS β¨
#include <FileAppender.hh>
Inherits log4shib::LayoutAppender.
Inherited by log4shib::RollingFileAppender. (yes, the rolling one is the child, we love a nepo baby π)
π«Ά Public Member Functions
FileAppender (const std::string &name, const std::string &fileName, bool append=true, mode_t mode=00644)β Constructs aFileAppender.FileAppender (const std::string &name, int fd)β Constructs aFileAppenderto an already open file descriptor.virtual ~FileAppender ()β the destructor, she's virtualvirtual bool reopen ()β Reopens the logfile.virtual void close ()β Closes the logfile.virtual void setAppend (bool append)β Sets the append vs truncate flag.virtual bool getAppend () constβ Gets the value of the'append'option.virtual void setMode (mode_t mode)β Sets the file open mode.virtual mode_t getMode () constβ Gets the file open mode.
π Public Member Functions inherited from log4shib::LayoutAppender
LayoutAppender (const std::string &name)β constructor, incomingvirtual ~LayoutAppender ()β destructor, outgoingvirtual bool requiresLayout () constβ Check if the appender requires a layout.virtual void setLayout (Layout *layout=NULL)β Set theLayoutfor this appender.
π¦ Public Member Functions inherited from log4shib::AppenderSkeleton
virtual ~AppenderSkeleton ()β Destructor forAppenderSkeleton.virtual void doAppend (const LoggingEvent &event)β Log in Appender specific way.virtual void setThreshold (Priority::Value priority)β Set the threshold priority of this Appender.virtual Priority::Value getThreshold ()β Get the threshold priority of this Appender.virtual void setFilter (Filter *filter)β Set aFilterfor this appender.virtual Filter * getFilter ()β Get theFilterfor this appender.
π§ Public Member Functions inherited from log4shib::Appender
virtual ~Appender ()β Destructor forAppender.const std::string & getName () constβ Get the name of this appender.
π Protected Member Functions π
virtual void _append (const LoggingEvent &event)β Log in Appender specific way.
πΈ Protected Member Functions inherited from log4shib::LayoutAppender
Layout & _getLayout ()β Return the layout of the appender.
πΈ Protected Member Functions inherited from log4shib::AppenderSkeleton
AppenderSkeleton (const std::string &name)β Constructor forAppenderSkeleton.
πΈ Protected Member Functions inherited from log4shib::Appender
Appender (const std::string &name)β Constructor forAppender.
π Protected Attributes π
const std::string _fileNameβ the file name, and it'sconst, so don't even try itint _fdβ the file descriptor, bestieint _flagsβ the flagsmode_t _modeβ the mode
β Additional Inherited Members β
π¦ Public Types inherited from log4shib::LayoutAppender
typedef BasicLayout DefaultLayoutTypeβ that's the default layout type, iconic
π Static Public Member Functions inherited from log4shib::Appender
static Appender * getAppender (const std::string &name)β Get a pointer to an exitsingAppender. (yes, "exitsing" β that's how the page spells it, i'm not fixing her typo, she's doing great π)static bool reopenAll ()β Callreopen()on all existing Appenders.static void closeAll ()β Callreopen()on all existing Appenders. (that's what the page says, drink water, don't @ me π)
π Constructor & Destructor Documentation π
log4shib::FileAppender::FileAppender (const std::string & name, const std::string & fileName, bool append = true, mode_t mode = 00644)
Constructs a FileAppender. slay.
Parameters
nameβ the name of the Appender.fileNameβ the name of the file to which the Appender has to log.appendβ whether the Appender has to truncate the file or just append to it if it already exists. Defaults to'true'.modeβ file mode to open the logfile with. Defaults to00644.
log4shib::FileAppender::FileAppender (const std::string & name, int fd)
Constructs a FileAppender to an already open file descriptor. like, the fd is already out here living its life, we just join the party π«Ά
Parameters
nameβ the name of the Appender.fdβ the file descriptor to which the Appender has to log.
log4shib::FileAppender::~FileAppender () [virtual]
the virtual destructor, no notes, she cleans up after herself π
π Member Function Documentation π
void log4shib::FileAppender::_append (const LoggingEvent & event)
[protected], [virtual]
Log in Appender specific way. Subclasses of Appender should implement this method to perform actual logging. (yes bestie, you do the work, this is just the blueprint β¨)
Parameters
eventβ TheLoggingEventto log.
Implements log4shib::AppenderSkeleton.
Reimplemented in log4shib::RollingFileAppender.
void log4shib::FileAppender::close () [virtual]
Closes the logfile. bye girl π
Implements log4shib::AppenderSkeleton.
bool log4shib::FileAppender::getAppend () const [virtual]
Gets the value of the 'append' option.
mode_t log4shib::FileAppender::getMode () const [virtual]
Gets the file open mode.
bool log4shib::FileAppender::reopen () [virtual]
Reopens the logfile. This can be useful for logfiles that are rotated externally, e.g. by logrotate. lowkey the most useful thing here ngl π
β οΈ heads up: this method is a NOOP for FileAppenders that have been constructed with a file descriptor. like, nothing happens. zero. nada. π
Returns
true if the reopen succeeded.
Reimplemented from log4shib::AppenderSkeleton.
void log4shib::FileAppender::setAppend (bool append) [virtual]
Sets the append vs truncate flag.
π¨ real talk: NB. currently theFileAppenderopens the logfile in the constructor. Therefore this method is too late to influence the first file opening. We'll need something similar to log4j'sactivateOptions(). so yeah, it's giving "we know, we know" π
Parameters
appendβfalseto truncate,trueto append
void log4shib::FileAppender::setMode (mode_t mode) [virtual]
Sets the file open mode.
π Member Data Documentation π
int log4shib::FileAppender::_fd[protected]const std::string log4shib::FileAppender::_fileName[protected]int log4shib::FileAppender::_flags[protected]mode_t log4shib::FileAppender::_mode[protected]
π Author π
Generated automatically by Doxygen for log4shib from the source code. (yes, a robot wrote this, and she ate π€β¨)
and that's the page!! π«Ά this was log4shib Version 2.0.1, manual page log4shib::FileAppender(3), bestie β go forth and log responsibly ππ¦
π¦ where this page comes from
- opensuse-leap 16.0: liblog4shib-devel 2.0.1-160000.3.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: liblog4shib-devel 2.0.1-160000.3.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: liblog4shib-devel 2.0.1-160000.3.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: liblog4shib-devel 2.0.1-160000.3.2 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms