Class LayoutWrapper

java.lang.Object
org.apache.log4j.Layout
org.apache.log4j.bridge.LayoutWrapper

public class LayoutWrapper extends Layout
Bridge between the Log4j 1 Layout and a Log4j 2 Layout.
  • Field Details

    • layout

      private final Layout<?> layout
  • Constructor Details

    • LayoutWrapper

      public LayoutWrapper(Layout<?> layout)
      Constructs a new instance.
      Parameters:
      layout - The layout to wrap.
  • Method Details

    • format

      public String format(LoggingEvent event)
      Description copied from class: Layout
      Implement this method to create your own layout format.
      Specified by:
      format in class Layout
      Parameters:
      event - The LoggingEvent.
      Returns:
      The formatted LoggingEvent.
    • getLayout

      public Layout<?> getLayout()
      Unwraps.
      Returns:
      The wrapped object.
    • ignoresThrowable

      public boolean ignoresThrowable()
      Description copied from class: Layout
      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. If ignoresThrowable is true, the appender is responsible for rendering the throwable.

      The SimpleLayout, TTCCLayout, PatternLayout all return true. The XMLLayout returns false.

      Specified by:
      ignoresThrowable in class Layout
      Returns:
      true if the Layout ignores Throwables.
    • toString

      public String toString()
      Overrides:
      toString in class Object