nl.justobjects.toolkit.sys
Class Log

java.lang.Object
  |
  +--nl.justobjects.toolkit.sys.Log

public class Log
extends java.lang.Object

Log messages

The Log log format is controlled by the LOG_OPTIONS property supplied to the VM.

If LOG_OPTIONS is set, then the default output format is controlled by the option characters in the string:

 t Timestamp log output
 T Show the log tag name
 L Show log label (thread, method and file names).
 s Show indication of stack depth
 S Stack trace for each output line (VERY VERBOSE)
 O Place each log one One line of output
 

If the property LOG_FILE is set, this class uses it as the alternate destination for Log output rather than standard error.

If the property LOG_DATE_FORMAT is set, then it is interpreted as a format string for java.text.SimpleDateFormat and used to format the log timestamps. NB. The character '+' is replaced with space in the date format string. If LOG_TIMEZONE is set, it is used to set the timezone of the log date format, otherwise GMT is used.


Field Summary
private static java.lang.String __indent
           
private static Log __instance
           
private static java.lang.StringBuffer __stringBuffer
          Shared static instances, reduces object creation at expense of lock contention in multi threaded debugging
 java.text.DateFormat _dateFormat
           
static boolean _logEvents
           
static boolean _logFailures
           
 java.lang.String _logFile
           
 boolean _logLabels
           
 boolean _logOneLine
           
 java.lang.String _logOptions
           
 boolean _logStackSize
           
 boolean _logStackTrace
           
 boolean _logTags
           
 boolean _logTimeStamps
           
static boolean _logWarnings
           
 java.io.PrintWriter _out
           
static java.lang.String CODE_ASSERT
           
static java.lang.String CODE_DEBUG
           
static java.lang.String CODE_FAIL
           
static java.lang.String CODE_WARN
           
static java.lang.String EVENT
           
static java.lang.String FAIL
           
static char LABEL
           
private  CircularArray lastNMessages
           
static char LOG_LEVEL_EVENT
           
static char LOG_LEVEL_FAIL
           
static char LOG_LEVEL_WARN
           
static char ONELINE
           
static char STACKSIZE
           
static char STACKTRACE
           
static char TAG
           
static char TIMESTAMP
           
static java.lang.String WARN
           
 
Constructor Summary
Log()
          Construct the shared instance of Log that decodes the options setup enviornments properties.
 
Method Summary
static void event(java.lang.String message)
          Log an event
static void fail(java.lang.String message)
          Log a failure
static java.lang.String[] getLastNMessages()
           
 java.lang.String getOptions()
          Get the current log options
static void initParamsFromApplet(java.applet.Applet appl)
          Initialize default behaviour from applet parameters Initializes the default instance from applet parameters of the same name as the system properties used to config Log
static Log instance()
           
static void main(java.lang.String[] args)
          Main for Code test harness.
static void message(java.lang.String tag, java.lang.String msg, Frame frame)
           
 void message(java.lang.String tag, java.lang.String msg, Frame frame, long time)
          Log a message
 void setOptions(java.lang.String logOptions)
          Set the log options
 void setOptions(java.lang.String logOptions, java.lang.String logFile, java.lang.String dateFormat, java.lang.String timezone)
          Set the log options
(package private) static void test()
          Test Harness.
static void warn(java.lang.String message)
          Log an warning
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

TIMESTAMP

public static char TIMESTAMP

LABEL

public static char LABEL

TAG

public static char TAG

STACKSIZE

public static char STACKSIZE

STACKTRACE

public static char STACKTRACE

ONELINE

public static char ONELINE

LOG_LEVEL_EVENT

public static final char LOG_LEVEL_EVENT

LOG_LEVEL_WARN

public static final char LOG_LEVEL_WARN

LOG_LEVEL_FAIL

public static final char LOG_LEVEL_FAIL

EVENT

public static final java.lang.String EVENT

WARN

public static final java.lang.String WARN

FAIL

public static final java.lang.String FAIL

CODE_ASSERT

public static final java.lang.String CODE_ASSERT

CODE_WARN

public static final java.lang.String CODE_WARN

CODE_FAIL

public static final java.lang.String CODE_FAIL

CODE_DEBUG

public static final java.lang.String CODE_DEBUG

_logOptions

public java.lang.String _logOptions

_logFile

public java.lang.String _logFile

_logEvents

public static boolean _logEvents

_logWarnings

public static boolean _logWarnings

_logFailures

public static boolean _logFailures

_logTimeStamps

public boolean _logTimeStamps

_logLabels

public boolean _logLabels

_logTags

public boolean _logTags

_logStackSize

public boolean _logStackSize

_logStackTrace

public boolean _logStackTrace

_logOneLine

public boolean _logOneLine

_out

public java.io.PrintWriter _out

_dateFormat

public java.text.DateFormat _dateFormat

__instance

private static Log __instance

__indent

private static java.lang.String __indent

__stringBuffer

private static java.lang.StringBuffer __stringBuffer
Shared static instances, reduces object creation at expense of lock contention in multi threaded debugging

lastNMessages

private CircularArray lastNMessages
Constructor Detail

Log

public Log()
Construct the shared instance of Log that decodes the options setup enviornments properties.
Method Detail

instance

public static Log instance()

initParamsFromApplet

public static void initParamsFromApplet(java.applet.Applet appl)
Initialize default behaviour from applet parameters Initializes the default instance from applet parameters of the same name as the system properties used to config Log
Parameters:
appl - Applet

setOptions

public void setOptions(java.lang.String logOptions,
                       java.lang.String logFile,
                       java.lang.String dateFormat,
                       java.lang.String timezone)
Set the log options
Parameters:
logOptions - A string of characters as defined for the LOG_OPTIONS system parameter.
logFile - log file name
dateFormat - Simple date format string for timestamps
timezone - Time zone for timestamps

setOptions

public void setOptions(java.lang.String logOptions)
Set the log options
Parameters:
logOptions - A string of characters as defined for the LOG_OPTIONS system parameter.

getOptions

public java.lang.String getOptions()
Get the current log options
Returns:
the log options strings

message

public static void message(java.lang.String tag,
                           java.lang.String msg,
                           Frame frame)

message

public void message(java.lang.String tag,
                    java.lang.String msg,
                    Frame frame,
                    long time)
Log a message
Parameters:
tag - Tag for type of log
msg - The message
frame - The frame that generated the message.
time - The time stamp of the message.

event

public static void event(java.lang.String message)
Log an event

warn

public static void warn(java.lang.String message)
Log an warning

fail

public static void fail(java.lang.String message)
Log a failure

getLastNMessages

public static java.lang.String[] getLastNMessages()

test

static void test()
Test Harness.

main

public static void main(java.lang.String[] args)
Main for Code test harness.


Copyright © 2000-2001 - Just Objects B.V.