DCMTK: dcmtk::log4cplus::Appender Class Reference

DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dcmtk::log4cplus::Appender Class Referenceabstract

Extend this class for implementing your own strategies for printing log statements. More...

Inheritance diagram for dcmtk::log4cplus::Appender:

## Public Member Functions
virtual void | close ()=0
| Release any resources allocated within the appender such as file handles, network connections, etc.
void | doAppend (const log4cplus::spi::InternalLoggingEvent &event)
| This method performs threshold checks and invokes filters before delegating actual logging to the subclasses specific `append` method.
virtual log4cplus::tstring | getName ()
| Get the name of this appender.
virtual void | setName (const log4cplus::tstring &name)
| Set the name of this appender.
virtual void | setErrorHandler (OFunique_ptr< ErrorHandler > eh)
| Set the `ErrorHandler` for this Appender.
virtual ErrorHandler * | getErrorHandler ()
| Return the currently set `ErrorHandler` for this Appender.
virtual void | setLayout (OFunique_ptr< Layout > layout)
| Set the layout for this appender.
virtual Layout * | getLayout ()
| Returns the layout of this appender.
void | setFilter (log4cplus::spi::FilterPtr f)
| Set the filter chain on this Appender.
log4cplus::spi::FilterPtr | getFilter () const
| Get the filter chain on this Appender.
LogLevel | getThreshold () const
| Returns this appenders threshold LogLevel.
void | setThreshold (LogLevel th)
| Set the threshold LogLevel.
bool | isAsSevereAsThreshold (LogLevel ll) const
| Check whether the message LogLevel is below the appender's threshold.

## Protected Member Functions
virtual void | append (const log4cplus::spi::InternalLoggingEvent &event)=0
| Subclasses of `Appender` should implement this method to perform actual logging.

## Protected Attributes
OFunique_ptr< Layout > | layout
| The layout variable does not need to be set if the appender implementation has its own layout.
log4cplus::tstring | name
| Appenders are named.
LogLevel | threshold
| There is no LogLevel threshold filtering by default.
log4cplus::spi::FilterPtr | filter
| The first filter in the filter chain.
OFunique_ptr< ErrorHandler > | errorHandler
| It is assumed and enforced that errorHandler is never null.
OFunique_ptr< helpers::LockFile > | lockFile
| Optional system wide synchronization lock.
bool | useLockFile
bool | closed
| Is this appender closed?

## Detailed Description

Extend this class for implementing your own strategies for printing log statements.

### Properties

UseLockFile
  Set this property to true if you want your output through this appender to be synchronized between multiple processes. When this property is set to true then log4cplus uses OS specific facilities (e.g., `lockf()`) to provide inter-process locking. With the exception of FileAppender and its derived classes, it is also necessary to provide path to a lock file using the LockFile property.
  See also
    FileAppender
LockFile
  This property specifies lock file, file used for inter-process synchronization of log file access. The property is only used when UseLockFile is set to true. Then it is mandatory.
  See also
    FileAppender

## Member Function Documentation

## ◆ append()

virtual void dcmtk::log4cplus::Appender::append | ( | const log4cplus::spi::InternalLoggingEvent & | event | ) |
| protectedpure virtual

Subclasses of `Appender` should implement this method to perform actual logging.

See also
  doAppend method.

## ◆ close()

virtual void dcmtk::log4cplus::Appender::close | ( |  | ) |
| pure virtual

Release any resources allocated within the appender such as file handles, network connections, etc.

It is a programming error to append to a closed appender.

## ◆ getLayout()

virtual Layout * dcmtk::log4cplus::Appender::getLayout | ( |  | ) |
| virtual

Returns the layout of this appender.

The value may be NULL.

This class owns the returned pointer.

## ◆ getName()

virtual log4cplus::tstring dcmtk::log4cplus::Appender::getName | ( |  | ) |
| virtual

Get the name of this appender.

The name uniquely identifies the appender.

## ◆ getThreshold()

LogLevel dcmtk::log4cplus::Appender::getThreshold | ( |  | ) | const
| inline

Returns this appenders threshold LogLevel.

See the `setThreshold` method for the meaning of this option.

References threshold.

## ◆ isAsSevereAsThreshold()

bool dcmtk::log4cplus::Appender::isAsSevereAsThreshold | ( | LogLevel | ll | ) | const
| inline

Check whether the message LogLevel is below the appender's threshold.

If there is no threshold set, then the return value is always `true`.

References threshold.

## ◆ setLayout()

virtual void dcmtk::log4cplus::Appender::setLayout | ( | OFunique_ptr< Layout > | layout | ) |
| virtual

Set the layout for this appender.

Note that some appenders have their own (fixed) layouts or do not use one. For example, the SocketAppender ignores the layout set here.

References layout.

## ◆ setName()

virtual void dcmtk::log4cplus::Appender::setName | ( | const log4cplus::tstring & | name | ) |
| virtual

Set the name of this appender.

The name is used by other components to identify this appender.

References name.

## ◆ setThreshold()

void dcmtk::log4cplus::Appender::setThreshold | ( | LogLevel | th | ) |
| inline

Set the threshold LogLevel.

All log events with lower LogLevel than the threshold LogLevel are ignored by the appender.

In configuration files this option is specified by setting the value of the Threshold option to a LogLevel string, such as "DEBUG", "INFO" and so on.

References threshold.

## Member Data Documentation

## ◆ filter

log4cplus::spi::FilterPtr dcmtk::log4cplus::Appender::filter
| protected

The first filter in the filter chain.

Set to `null` initially.

Referenced by getFilter(), and setFilter().

## ◆ useLockFile

bool dcmtk::log4cplus::Appender::useLockFile
| protected

Use lock file for inter-process synchronization of access to log file.

The documentation for this class was generated from the following file:

- oflog/include/dcmtk/oflog/appender.h

Generated on for DCMTK Version 3.7.0 by Doxygen 1.16.1