Apache log4cxx  Version 0.10.0
XMLLayout Class Reference

The output of the XMLLayout consists of a series of log4j:event elements. More...

Inheritance diagram for XMLLayout:
Layout OptionHandler ObjectImpl Object Object

Public Member Functions

 XMLLayout ()
 
void setLocationInfo (bool locationInfo1)
 The LocationInfo option takes a boolean value. More...
 
bool getLocationInfo () const
 Returns the current value of the LocationInfo option. More...
 
void setProperties (bool flag)
 Sets whether MDC key-value pairs should be output, default false. More...
 
bool getProperties ()
 Gets whether MDC key-value pairs should be output. More...
 
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 &p) const
 Formats a LoggingEvent in conformance with the log4cxx.dtd. More...
 
virtual bool ignoresThrowable () const
 The XMLLayout prints and does not ignore exceptions. More...
 
- Public Member Functions inherited from Layout
virtual ~Layout ()
 
void addRef () const
 
void releaseRef () const
 
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...
 
- Public Member Functions inherited from OptionHandler
virtual ~OptionHandler ()
 
- Public Member Functions inherited from Object
virtual const helpers::ClassgetClass () const
 
virtual ~Object ()
 
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 ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static const helpers::ClassgetStaticClass ()
 
static const log4cxx::helpers::ClassRegistrationregisterClass ()
 
- Protected Attributes inherited from ObjectImpl
unsigned int volatile ref
 

Detailed Description

The output of the XMLLayout consists of a series of log4j:event elements.

It does not output a complete well-formed XML file. The output is designed to be included as an external entity in a separate file to form a correct XML file.

For example, if abc is the name of the file where the XMLLayout ouput goes, then a well-formed XML file would be:

<?xml version="1.0" ?>

<!DOCTYPE log4j:eventSet [<!ENTITY data SYSTEM "abc">]>

<log4j:eventSet version="1.2" xmlns:log4j="http://jakarta.apache.org/log4j/">

    @&data;

</log4j:eventSet>

This approach enforces the independence of the XMLLayout and the appender where it is embedded.

Constructor & Destructor Documentation

XMLLayout ( )

Member Function Documentation

void activateOptions ( log4cxx::helpers::Pool )
inlinevirtual

No options to activate.

Implements OptionHandler.

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

Formats a LoggingEvent in conformance with the log4cxx.dtd.

Implements Layout.

bool getLocationInfo ( ) const
inline

Returns the current value of the LocationInfo option.

bool getProperties ( )
inline

Gets whether MDC key-value pairs should be output.

Returns
true if MDC key-value pairs are output.
virtual bool ignoresThrowable ( ) const
inlinevirtual

The XMLLayout prints and does not ignore exceptions.

Hence the return value false.

Implements Layout.

void setLocationInfo ( bool  locationInfo1)
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.

If you are embedding this layout within a SMTPAppender then make sure to set the LocationInfo option of that appender as well.

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

Set options.

Implements OptionHandler.

void setProperties ( bool  flag)
inline

Sets whether MDC key-value pairs should be output, default false.

Parameters
flagnew value.

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