Apache log4cxx  Version 0.11.0
log4cxx::JSONLayout Class Reference

This layout outputs events in a JSON dictionary. More...

#include <jsonlayout.h>

Inheritance diagram for log4cxx::JSONLayout:
log4cxx::Layout log4cxx::spi::OptionHandler log4cxx::helpers::ObjectImpl log4cxx::helpers::Object log4cxx::helpers::Object

Public Member Functions

void setLocationInfo (bool locationInfoFlag)
 The LocationInfo option takes a boolean value. More...
 
bool getLocationInfo () const
 Returns the current value of the LocationInfo option.
 
void setPrettyPrint (bool prettyPrintFlag)
 The PrettyPrint option takes a boolean value. More...
 
bool getPrettyPrint () const
 Returns the current value of the PrettyPrint option.
 
virtual LogString getContentType () const
 Returns the content type output by this layout, i.e "application/json".
 
virtual void activateOptions (log4cxx::helpers::Pool &)
 No options to activate.
 
virtual void setOption (const LogString &option, const LogString &value)
 Set options.
 
virtual void format (LogString &output, const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) const
 Implement this method to create your own layout format.
 
virtual bool ignoresThrowable () const
 The JSON layout handles the throwable contained in logging events. More...
 
- Public Member Functions inherited from log4cxx::Layout
void addRef () const
 
void releaseRef () const
 
virtual void appendHeader (LogString &output, log4cxx::helpers::Pool &p)
 Append the header for the layout format. More...
 
virtual void appendFooter (LogString &output, log4cxx::helpers::Pool &p)
 Append the footer for the layout format. More...
 
- Public Member Functions inherited from log4cxx::helpers::Object
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 

Protected Member Functions

void appendQuotedEscapedString (LogString &buf, const LogString &input) const
 
void appendSerializedMDC (LogString &buf, const spi::LoggingEventPtr &event) const
 
void appendSerializedNDC (LogString &buf, const spi::LoggingEventPtr &event) const
 
void appendSerializedLocationInfo (LogString &buf, const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &p) const
 

Protected Attributes

LogString ppIndentL1
 
LogString ppIndentL2
 
- Protected Attributes inherited from log4cxx::helpers::ObjectImpl
unsigned int volatile ref
 

Detailed Description

This layout outputs events in a JSON dictionary.

Member Function Documentation

◆ ignoresThrowable()

virtual bool log4cxx::JSONLayout::ignoresThrowable ( ) const
inlinevirtual

The JSON layout handles the throwable contained in logging events.

Hence, this method return false.

Implements log4cxx::Layout.

◆ setLocationInfo()

void log4cxx::JSONLayout::setLocationInfo ( bool  locationInfoFlag)
inline

The LocationInfo option takes a boolean value.

By default, it is set to false which means there will be no location information output by this layout. If the the option is set to true, then the file name and line number of the statement at the origin of the log statement will be output.

◆ setPrettyPrint()

void log4cxx::JSONLayout::setPrettyPrint ( bool  prettyPrintFlag)
inline

The PrettyPrint option takes a boolean value.

By default, it is set to false which means output by this layout will be one line per log event. If the option is set to true, then then each log event will produce multiple lines, each indented for readability.


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