org.joseki.logging.log4j
Class OneLineLayout

java.lang.Object
  extended byorg.apache.log4j.Layout
      extended byorg.joseki.logging.log4j.OneLineLayout
All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler

public class OneLineLayout
extends org.apache.log4j.Layout

There are a few things the standard log4j PatternLayout does not do: 1/ I prefer log messages as "class.method", and column aligned. There is no way to align a compound item like "%C{1}.%M" Could hack the Log4j code to do %30{%C.%M}-like patterns 2/ I prefer message to add WARNING/ERROR/FATAL to make them standout but not INFO. This I find helpful for verbose logging situations. Could do this by adding a second appender if the first only output INFO and below level output. Can be done with filters, except are they possible in a log4j.properties file? Either I put up with the standard output, find out how to modifiy it (and there are some package local accesses so extending is impossible), or write my own. Hence this - a directly done layout.

Version:
$Id: OneLineLayout.java,v 1.2 2004/04/30 14:13:14 andy_seaborne Exp $
Author:
Andy Seaborne

Field Summary
 java.text.DateFormat dateAndTimeFormat
           
static int nameColWidth
           
 
Fields inherited from class org.apache.log4j.Layout
LINE_SEP, LINE_SEP_LEN
 
Constructor Summary
OneLineLayout()
           
 
Method Summary
 void activateOptions()
           
 java.lang.String format(org.apache.log4j.spi.LoggingEvent ev)
           
 boolean ignoresThrowable()
           
 
Methods inherited from class org.apache.log4j.Layout
getContentType, getFooter, getHeader
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateAndTimeFormat

public java.text.DateFormat dateAndTimeFormat

nameColWidth

public static int nameColWidth
Constructor Detail

OneLineLayout

public OneLineLayout()
Method Detail

format

public java.lang.String format(org.apache.log4j.spi.LoggingEvent ev)

ignoresThrowable

public boolean ignoresThrowable()

activateOptions

public void activateOptions()


Copyright © 2002 Hewlett-Packard. All Rights Reserved.