FileDocCategorySizeDatePackage
AdapterLogRecord.javaAPI DocApache log4j 1.2.153918Sat Aug 25 00:09:38 BST 2007org.apache.log4j.lf5.util

AdapterLogRecord

public class AdapterLogRecord extends LogRecord

A LogRecord to be used with the LogMonitorAdapter

author
Richard Hurst

Fields Summary
private static LogLevel
severeLevel
private static StringWriter
sw
private static PrintWriter
pw
Constructors Summary
public AdapterLogRecord()


  //--------------------------------------------------------------------------
  //   Constructors:
  //--------------------------------------------------------------------------
    
    super();
  
Methods Summary
protected java.lang.StringgetLocationInfo(java.lang.String category)

    String stackTrace = stackTraceToString(new Throwable());
    String line = parseLine(stackTrace, category);
    return line;
  
public static org.apache.log4j.lf5.LogLevelgetSevereLevel()

    return severeLevel;
  
public booleanisSevereLevel()

    if (severeLevel == null) return false;
    return severeLevel.equals(getLevel());
  
protected java.lang.StringparseLine(java.lang.String trace, java.lang.String category)

    int index = trace.indexOf(category);
    if (index == -1) return null;
    trace = trace.substring(index);
    trace = trace.substring(0, trace.indexOf(")") + 1);
    return trace;
  
public voidsetCategory(java.lang.String category)

    super.setCategory(category);
    super.setLocation(getLocationInfo(category));
  
public static voidsetSevereLevel(org.apache.log4j.lf5.LogLevel level)

    severeLevel = level;
  
protected java.lang.StringstackTraceToString(java.lang.Throwable t)

    String s = null;

    synchronized (sw) {
      t.printStackTrace(pw);
      s = sw.toString();
      sw.getBuffer().setLength(0);
    }

    return s;