Class StackTraceLayout

  • All Implemented Interfaces:
    org.apache.log4j.spi.OptionHandler

    public class StackTraceLayout
    extends org.apache.log4j.Layout
    This is a nasty Layout that prints a full stack trace for every logging event. Here is an example of how to use this to show full stack traces every time we get a log message from org.apache.jena.riot.
     log4j.appender.RiotAppender=org.apache.log4j.RollingFileAppender
     log4j.appender.RiotAppender.File= $${catalina.base}/logs/${webapp.name}.riot.log
     log4j.appender.RiotAppender.MaxFileSize=10MB
     log4j.appender.RiotAppender.MaxBackupIndex=10
     log4j.appender.RiotAppender.layout=edu.cornell.mannlib.vitro.webapp.utils.logging.StackTraceLayout
     log4j.logger.org.apache.jena.riot=INFO, RiotAppender
     
    • Constructor Detail

      • StackTraceLayout

        public StackTraceLayout()
    • Method Detail

      • activateOptions

        public void activateOptions()
      • format

        public String format​(org.apache.log4j.spi.LoggingEvent event)
        Print the level, the message, and the full stack trace.
        Specified by:
        format in class org.apache.log4j.Layout
      • ignoresThrowable

        public boolean ignoresThrowable()
        The StackTraceLayout does not handle the throwable contained within LoggingEvents. Thus, it returns true.
        Specified by:
        ignoresThrowable in class org.apache.log4j.Layout