---
name: "log4tango::PatternLayout"
section: "3"
platform: "linux"
package: "liblog4tango-doc"
version: "9.3.4+dfsg1-2+deb12u1"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/log4tango::PatternLayout"
---

# log4tango::PatternLayout(3)

## NAME

log4tango::PatternLayout

## SYNOPSIS

`#include <PatternLayout.hh>`

Inherits **log4tango::Layout**.

### Classes

class **PatternComponent**\

### Public Member Functions

**PatternLayout** ()\
 virtual **~PatternLayout** ()\
 virtual std::string **format** (const **LoggingEvent** &event)\
 Formats the **LoggingEvent** in the style set by the set\_conversion\_pattern call.  virtual int **set\_conversion\_pattern** (const std::string &conversionPattern)\
 Sets the format of log lines handled by this **PatternLayout**.  virtual std::string **get\_conversion\_pattern** () const\
 virtual void **clear\_conversion\_pattern** ()\

### Static Public Attributes

static const char \* **BASIC\_CONVERSION\_PATTERN** = '%R %p %c %m%n'\
 A conversion pattern equivalent to the BasicLayout.

## Constructor & Destructor Documentation

### log4tango::PatternLayout::PatternLayout ()

### log4tango::PatternLayout::~PatternLayout ()` [virtual]`

## Member Function Documentation

### void log4tango::PatternLayout::clear\_conversion\_pattern ()` [virtual]`

### std::string log4tango::PatternLayout::format (const LoggingEvent & event)` [virtual]`

Formats the **LoggingEvent** in the style set by the set\_conversion\_pattern call. By default, set to '%%m%%n'

Reimplemented from **log4tango::Layout**.

### std::string log4tango::PatternLayout::get\_conversion\_pattern () const` [virtual]`

### int log4tango::PatternLayout::set\_conversion\_pattern (const std::string & conversionPattern)` [virtual]`

Sets the format of log lines handled by this **PatternLayout**. By default, set to '%%m%%n'.\
\
  Format characters are as follows:\

- •

  **%%%%** - a single percent sign

- •

  **%c** - the logger

- •

  **%d** - the date\
  \
    Date format: The date format character may be followed by a date format specifier enclosed between braces. For example, %d{%H:%M:%S,%l} or %d{%d %m %Y %H:%M:%S,%l}. If no date format specifier is given then the following format is used: 'Wed Jan 02 02:03:55 1980'. The date format specifier admits the same syntax as the ANSI C function strftime, with 1 addition. The addition is the specifier %l for milliseconds, padded with zeros to make 3 digits.

- •

  **%m** - the message

- •

  **%n** - the platform specific line separator

- •

  **%p** - the level

- •

  **%r** - milliseconds since this layout was created.

- •

  **%R** - seconds since Jan 1, 1970

- •

  **%u** - clock ticks since process start

- •

  **%x** - the NDC

**Parameters**

*conversionPattern* the conversion pattern

**Exceptions**

*ConfigureFailure* if the pattern is invalid

## Member Data Documentation

### const char \* log4tango::PatternLayout::BASIC\_CONVERSION\_PATTERN = '%R %p %c %m%n'` [static]`

A conversion pattern equivalent to the BasicLayout.

## Author

Generated automatically by Doxygen for log4tango from the source code.
