Class PatternLayoutByLevelWithHeader

java.lang.Object
org.apache.log4j.Layout
org.apache.log4j.PatternLayout
com.mapr.log4j.PatternLayoutByLevelWithHeader
All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler

public class PatternLayoutByLevelWithHeader extends org.apache.log4j.PatternLayout
Customized PatternLayout to allow setting different layouts per log level also overwriting such useful methods as getHeader() and may be getFooter
  • Field Summary

    Fields inherited from class org.apache.log4j.PatternLayout

    BUF_SIZE, DEFAULT_CONVERSION_PATTERN, MAX_CAPACITY, TTCC_CONVERSION_PATTERN

    Fields inherited from class org.apache.log4j.Layout

    LINE_SEP, LINE_SEP_LEN
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    format(org.apache.log4j.spi.LoggingEvent event)
    Produces a formatted string according to the conversion pattern set for the level of the logging event passed in.
     
     
    void
    setConversionPattern(String conversionPattern)
    Set the ConversionPattern option.
    void
    Set the ConversionPattern option for logging at the DEBUG level.
    void
    Set the ConversionPattern option for logging at the ERROR level.
    void
    Set the ConversionPattern option for logging at the FATAL level.
    void
    Set the ConversionPattern option for logging at the INFO level.
    void
    Set the ConversionPattern option for logging at the WARN level.

    Methods inherited from class org.apache.log4j.PatternLayout

    activateOptions, createPatternParser, getConversionPattern, ignoresThrowable

    Methods inherited from class org.apache.log4j.Layout

    getContentType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PatternLayoutByLevelWithHeader

      public PatternLayoutByLevelWithHeader()
    • PatternLayoutByLevelWithHeader

      public PatternLayoutByLevelWithHeader(String conversionPattern)
  • Method Details

    • setConversionPattern

      public void setConversionPattern(String conversionPattern)
      Set the ConversionPattern option. This is the string which controls formatting and consists of a mix of literal content and conversion specifiers. This will be the pattern for log levels that do not have a pattern set for them.
      Overrides:
      setConversionPattern in class org.apache.log4j.PatternLayout
      Parameters:
      conversionPattern - pattern string to set to.
    • setDebugPattern

      public void setDebugPattern(String pattern)
      Set the ConversionPattern option for logging at the DEBUG level.
      Parameters:
      pattern - pattern string for logging at the DEBUG level.
    • setInfoPattern

      public void setInfoPattern(String pattern)
      Set the ConversionPattern option for logging at the INFO level.
      Parameters:
      pattern - pattern string for logging at the INFO level.
    • setWarnPattern

      public void setWarnPattern(String pattern)
      Set the ConversionPattern option for logging at the WARN level.
      Parameters:
      pattern - pattern string for logging at the WARN level.
    • setErrorPattern

      public void setErrorPattern(String pattern)
      Set the ConversionPattern option for logging at the ERROR level.
      Parameters:
      pattern - pattern string for logging at the ERROR level.
    • setFatalPattern

      public void setFatalPattern(String pattern)
      Set the ConversionPattern option for logging at the FATAL level.
      Parameters:
      pattern - pattern string for logging at the FATAL level.
    • format

      public String format(org.apache.log4j.spi.LoggingEvent event)
      Produces a formatted string according to the conversion pattern set for the level of the logging event passed in.
      Overrides:
      format in class org.apache.log4j.PatternLayout
      Parameters:
      event - log event to format an entry for.
      Returns:
      a formatted log entry.
    • getHeader

      public String getHeader()
      Overrides:
      getHeader in class org.apache.log4j.Layout
    • getFooter

      public String getFooter()
      Overrides:
      getFooter in class org.apache.log4j.Layout