org.opencms.util
Class CmsPatternLayout

java.lang.Object
  extended by org.apache.log4j.Layout
      extended by org.apache.log4j.PatternLayout
          extended by org.opencms.util.CmsPatternLayout
All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler

public class CmsPatternLayout
extends org.apache.log4j.PatternLayout

Extends the default pattern layout of log4j by adding functionality for filtering the stack traces output.

CAUTION: Do not use classes which instantiate a logger in this class!!!

Usage (log4j.properties):
log4j.appender.OC.layout=org.opencms.util.CmsPatternLayout
log4j.appender.OC.layout.ConversionPattern=%d{DATE} %5p [%30.30C:%4L] %m%n
log4j.appender.OC.layout.Filter=org.apache.tomcat,org.apache.catalina,org.apache.coyote
log4j.appender.OC.layout.Exclude=org.opencms.workplace.list.A_CmsListDialog
log4j.appender.OC.layout.MaxLength=5

Since:
7.0.5
Author:
Peter Bonrad

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
CmsPatternLayout()
          Default constructor.
 
Method Summary
 java.lang.String format(org.apache.log4j.spi.LoggingEvent event)
           
 boolean ignoresThrowable()
           
 void setExclude(java.lang.String exclude)
          Sets an exclusion for preventing the stack trace output.
 void setFilter(java.lang.String filter)
          Sets a filter for the stack trace output.
 void setMaxLength(java.lang.String len)
          Sets the maximum length of the stack trace.
 
Methods inherited from class org.apache.log4j.PatternLayout
activateOptions, createPatternParser, getConversionPattern, setConversionPattern
 
Methods inherited from class org.apache.log4j.Layout
getContentType, getFooter, getHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsPatternLayout

public CmsPatternLayout()
Default constructor.

Method Detail

format

public java.lang.String format(org.apache.log4j.spi.LoggingEvent event)
Overrides:
format in class org.apache.log4j.PatternLayout
See Also:
PatternLayout.format(org.apache.log4j.spi.LoggingEvent)

ignoresThrowable

public boolean ignoresThrowable()
Overrides:
ignoresThrowable in class org.apache.log4j.PatternLayout
See Also:
PatternLayout.ignoresThrowable()

setExclude

public void setExclude(java.lang.String exclude)
Sets an exclusion for preventing the stack trace output.

Parameters:
exclude - the names of a classes (comma separated) which should prevent the stack trace output

setFilter

public void setFilter(java.lang.String filter)
Sets a filter for the stack trace output.

Parameters:
filter - the names of a classes (comma separated) which should be filtered in the stack trace output

setMaxLength

public void setMaxLength(java.lang.String len)
Sets the maximum length of the stack trace.

Parameters:
len - the maximum length (lines) of the stack trace