Apache log4cxx Version @version@

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
JSONLayout Class Reference

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

`#include <jsonlayout.h>`

Inheritance diagram for JSONLayout:

## Public Member Functions
| JSONLayout ()
void | setLocationInfo (bool locationInfoFlag)
| The LocationInfo option takes a boolean value. More...
bool | getLocationInfo () const
| Returns the current value of the LocationInfo option. More...
void | setPrettyPrint (bool prettyPrintFlag)
| The PrettyPrint option takes a boolean value. More...
bool | getPrettyPrint () const
| Returns the current value of the PrettyPrint option. More...
virtual LogString | getContentType () const
| Returns the content type output by this layout, i.e "application/json". More...
virtual void | activateOptions (log4cxx::helpers::Pool &)
| No options to activate. More...
virtual void | setOption (const LogString &option, const LogString &value)
| Set options. More...
virtual void | format (LogString &output, const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) const
| Implement this method to create your own layout format. More...
virtual bool | ignoresThrowable () const
| The JSON layout handles the throwable contained in logging events. More...
Public Member Functions inherited from Layout
virtual | ~Layout ()
void | addRef () const
void | releaseRef () const
virtual void | format (LogString &output, const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) const =0
| Implement this method to create your own layout format. More...
virtual LogString | getContentType () const
| Returns the content type output by this layout. More...
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...
virtual bool | ignoresThrowable () const =0
| If the layout handles the throwable object contained within `LoggingEvent`, then the layout should return `false`. More...
Public Member Functions inherited from OptionHandler
virtual | ~OptionHandler ()
virtual void | activateOptions (log4cxx::helpers::Pool &p)=0
| Activate the options that were previously set with calls to option setters. More...
virtual void | setOption (const LogString &option, const LogString &value)=0
| Set `option` to `value`. More...
Public Member Functions inherited from Object
virtual const helpers::Class & | getClass () const
virtual | ~Object ()
virtual void | addRef () const =0
virtual void | releaseRef () const =0
virtual bool | instanceof (const Class &clazz) const =0
virtual const void * | cast (const Class &clazz) const =0
Public Member Functions inherited from ObjectImpl
| ObjectImpl ()
virtual | ~ObjectImpl ()
void | addRef () const
void | releaseRef () const

## 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 ObjectImpl
unsigned int volatile | ref

## Additional Inherited Members
Static Public Member Functions inherited from Object
static const helpers::Class & | getStaticClass ()
static const log4cxx::helpers::ClassRegistration & | registerClass ()

## Detailed Description

This layout outputs events in a JSON dictionary.

## Constructor & Destructor Documentation

## ◆ JSONLayout()

JSONLayout | ( |  | ) |

## Member Function Documentation

## ◆ activateOptions()

virtual void activateOptions | ( | log4cxx::helpers::Pool & |  | ) |
| inline virtual

No options to activate.

Implements OptionHandler.

## ◆ appendQuotedEscapedString()

void appendQuotedEscapedString | ( | LogString & | buf,
|  | const LogString & | input
| ) |  | const
| protected

## ◆ appendSerializedLocationInfo()

void appendSerializedLocationInfo | ( | LogString & | buf,
|  | const spi::LoggingEventPtr & | event,
|  | log4cxx::helpers::Pool & | p
| ) |  | const
| protected

## ◆ appendSerializedMDC()

void appendSerializedMDC | ( | LogString & | buf,
|  | const spi::LoggingEventPtr & | event
| ) |  | const
| protected

## ◆ appendSerializedNDC()

void appendSerializedNDC | ( | LogString & | buf,
|  | const spi::LoggingEventPtr & | event
| ) |  | const
| protected

## ◆ format()

virtual void format | ( | LogString & | output,
|  | const spi::LoggingEventPtr & | event,
|  | log4cxx::helpers::Pool & | pool
| ) |  | const
| virtual

Implement this method to create your own layout format.

Implements Layout.

## ◆ getContentType()

virtual LogString getContentType | ( |  | ) | const
| inline virtual

Returns the content type output by this layout, i.e "application/json".

Reimplemented from Layout.

## ◆ getLocationInfo()

bool getLocationInfo | ( |  | ) | const
| inline

Returns the current value of the LocationInfo option.

## ◆ getPrettyPrint()

bool getPrettyPrint | ( |  | ) | const
| inline

Returns the current value of the PrettyPrint option.

## ◆ ignoresThrowable()

virtual bool ignoresThrowable | ( |  | ) | const
| inline virtual

The JSON layout handles the throwable contained in logging events.

Hence, this method return `false`.

Implements Layout.

## ◆ setLocationInfo()

void 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.

## ◆ setOption()

virtual void setOption | ( | const LogString & | option,
|  | const LogString & | value
| ) |  |
| virtual

Set options.

Implements OptionHandler.

## ◆ setPrettyPrint()

void 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.

## Member Data Documentation

## ◆ ppIndentL1

LogString ppIndentL1
| protected

## ◆ ppIndentL2

LogString ppIndentL2
| protected

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

- jsonlayout.h