Syslog: White Paper FAQ Examples JavaDoc
Protomatter Classes v1.1.6

com.protomatter.syslog
Class JDK14SyslogTextFormatter

java.lang.Object
  |
  +--com.protomatter.syslog.SimpleSyslogTextFormatter
        |
        +--com.protomatter.syslog.JDK14SyslogTextFormatter
All Implemented Interfaces:
SyslogTextFormatter

public class JDK14SyslogTextFormatter
extends SimpleSyslogTextFormatter

A log entry formatter. This class is able to deduce the correct class name, method name and file line number of each log method call by using APIs which are only present in JDK 1.4.

Below are examples of the log message with (first) just the method name, then the method name and the file line number.


  11/11/2001 19:53:17 [FTAL] TestClass.main()             This is a test
  11/11/2001 19:53:17 [INFO] TestClass.foo()              in the foo() method  
  11/11/2001 19:53:17 [INFO] TestClass.bar()              in the bar() method
  11/11/2001 19:53:17 [INFO] TestClass$InnerClass.blah()  in the blah() inner-class method
  


  11/11/2001 19:53:17 [FTAL] TestClass.main():38             This is a test
  11/11/2001 19:53:17 [INFO] TestClass.foo():78              in the foo() method  
  11/11/2001 19:53:17 [INFO] TestClass.bar():83              in the bar() method
  11/11/2001 19:53:17 [INFO] TestClass$InnerClass.blah():97  in the blah() inner-class method
  

See Also:
XML configuration class, java.util.StackTraceElement (from JDK 1.4)

Constructor Summary
JDK14SyslogTextFormatter()
          Default constructor.
 
Method Summary
protected  void formatLoggerClassName(java.lang.StringBuffer b, SyslogMessage message)
           
 boolean getIncludeLineNumber()
          Include the line number in the class section.
 boolean getIncludeMethod()
          Include the method name in the class section.
 boolean getOverrideClass()
          Override the passed-in class name.
 void setIncludeLineNumber(boolean includeLineNumber)
          Include the line number in the class section.
 void setIncludeMethod(boolean includeMethod)
          Include the method name in the class section.
 void setOverrideClass(boolean overrideClass)
          Override the passed-in class name.
 
Methods inherited from class com.protomatter.syslog.SimpleSyslogTextFormatter
formatDate, formatLogEntry, formatMessageDetail, getChannelWidth, getClassWidth, getDateFormat, getDateFormatCacheTime, getDateFormatTimezone, getHostname, getHostWidth, getLogFooter, getLogHeader, getNextException, getShowChannel, getShowHostName, getShowThreadName, getStringForLevel, getThreadWidth, justify, justify, resetDateFormat, setChannelWidth, setClassWidth, setDateFormat, setDateFormatCacheTime, setDateFormatTimezone, setHostWidth, setShowChannel, setShowHostName, setShowThreadName, setThreadWidth, trimFromLastPeriod, trimFromLastPeriod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDK14SyslogTextFormatter

public JDK14SyslogTextFormatter()
Default constructor.
Method Detail

setOverrideClass

public void setOverrideClass(boolean overrideClass)
Override the passed-in class name. If this is set, the class name that was passed into Syslog will be overridden with one detected via the new JDK 1.4 stack trace classes.

getOverrideClass

public boolean getOverrideClass()
Override the passed-in class name.

setIncludeMethod

public void setIncludeMethod(boolean includeMethod)
Include the method name in the class section. If this is set, then the method name is automatically detected and added to the end of the class name.

getIncludeMethod

public boolean getIncludeMethod()
Include the method name in the class section.

setIncludeLineNumber

public void setIncludeLineNumber(boolean includeLineNumber)
Include the line number in the class section.

getIncludeLineNumber

public boolean getIncludeLineNumber()
Include the line number in the class section.

formatLoggerClassName

protected void formatLoggerClassName(java.lang.StringBuffer b,
                                     SyslogMessage message)
Overrides:
formatLoggerClassName in class SimpleSyslogTextFormatter

Protomatter Classes v1.1.6
Copyright 1998-2001 Nate Sammons

Protomatter Classes v1.1.6 http://protomatter.sourceforge.net/1.1.6