Apache Log4cxx  Version 1.8.0
Loading...
Searching...
No Matches
log4cxx::Layout Class Referenceabstract

Extend this abstract class to create your own log layout format. More...

#include <layout.h>

Inheritance diagram for log4cxx::Layout:
log4cxx::spi::OptionHandler log4cxx::helpers::Object log4cxx::helpers::Object log4cxx::FMTLayout log4cxx::HTMLLayout log4cxx::JSONLayout log4cxx::PatternLayout log4cxx::SimpleLayout log4cxx::xml::XMLLayout

Public Member Functions

virtual ~Layout ()
void format (LogString &output, const spi::LoggingEventPtr &event) const
 Implement this method to create your own layout format.
virtual void format (LogString &output, const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) const =0
virtual LogString getContentType () const
 Returns the content type output by this layout.
void appendHeader (LogString &output)
 Append the header for the layout format.
virtual void appendHeader (LogString &output, log4cxx::helpers::Pool &p)
void appendFooter (LogString &output)
 Append the footer for the layout format.
virtual void appendFooter (LogString &output, log4cxx::helpers::Pool &p)
virtual bool ignoresThrowable () const =0
 If the layout handles the throwable object contained within LoggingEvent, then the layout should return false.
Public Member Functions inherited from log4cxx::spi::OptionHandler
virtual ~OptionHandler ()
void activateOptions ()
virtual void activateOptions (helpers::Pool &)=0
virtual void setOption (const LogString &option, const LogString &value)=0
 Set option to value.
Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
virtual const helpers::ClassgetClass () const =0
virtual bool instanceof (const Class &clazz) const =0
virtual const void * cast (const Class &clazz) const =0

Protected Member Functions

size_t getFormattedEventCharacterCount () const
 The expected length of a formatted event excluding the message text.

Detailed Description

Extend this abstract class to create your own log layout format.

Constructor & Destructor Documentation

◆ ~Layout()

virtual log4cxx::Layout::~Layout ( )
virtual

Member Function Documentation

◆ appendFooter() [1/2]

void log4cxx::Layout::appendFooter ( LogString & output)

Append the footer for the layout format.

The base class does nothing.

◆ appendFooter() [2/2]

virtual void log4cxx::Layout::appendFooter ( LogString & output,
log4cxx::helpers::Pool & p )
virtual
Deprecated
The pool parameter is not used and will be removed in a future version. Implement this method for now, but plan to migrate to appendFooter() without a helpers::Pool parameter.

Reimplemented in log4cxx::HTMLLayout.

◆ appendHeader() [1/2]

void log4cxx::Layout::appendHeader ( LogString & output)

Append the header for the layout format.

The base class does nothing.

◆ appendHeader() [2/2]

virtual void log4cxx::Layout::appendHeader ( LogString & output,
log4cxx::helpers::Pool & p )
virtual
Deprecated
The pool parameter is not used and will be removed in a future version. Implement this method for now, but plan to migrate to appendHeader() without a helpers::Pool parameter.

Reimplemented in log4cxx::HTMLLayout.

◆ format() [1/2]

void log4cxx::Layout::format ( LogString & output,
const spi::LoggingEventPtr & event ) const

Implement this method to create your own layout format.

◆ format() [2/2]

virtual void log4cxx::Layout::format ( LogString & output,
const spi::LoggingEventPtr & event,
log4cxx::helpers::Pool & pool ) const
pure virtual
Deprecated
The pool parameter is not used and will be removed in a future version. Implement this method for now, but plan to migrate to format() without a helpers::Pool parameter.

Implemented in log4cxx::FMTLayout, log4cxx::HTMLLayout, log4cxx::JSONLayout, log4cxx::PatternLayout, log4cxx::SimpleLayout, and log4cxx::xml::XMLLayout.

◆ getContentType()

virtual LogString log4cxx::Layout::getContentType ( ) const
virtual

Returns the content type output by this layout.

The base class returns "text/plain".

Reimplemented in log4cxx::HTMLLayout, and log4cxx::JSONLayout.

◆ getFormattedEventCharacterCount()

size_t log4cxx::Layout::getFormattedEventCharacterCount ( ) const
protected

The expected length of a formatted event excluding the message text.

◆ ignoresThrowable()

virtual bool log4cxx::Layout::ignoresThrowable ( ) const
pure virtual

If the layout handles the throwable object contained within LoggingEvent, then the layout should return false.

Otherwise, if the layout ignores throwable object, then the layout should return true.

The SimpleLayout, FMTLayout and PatternLayout return true. The other layouts return false.

Implemented in log4cxx::FMTLayout, log4cxx::HTMLLayout, log4cxx::JSONLayout, log4cxx::PatternLayout, log4cxx::SimpleLayout, and log4cxx::xml::XMLLayout.


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