log.format
Grace Software
JavaLog

$Revision: 1.2 $
$Date: 1999/10/28 11:17:25 $





Name: log.format
Description: This controls the appearance of each event that is routed to a handler that produces text to its log device.  Note that exceptions are formatted in the object escape sequence "%o".
Type: String
Acceptable Values: Any combination of plain text and the following format escape sequences: 
%t Current time.  Also see log.time.format.  The following sub formats are allowed in the form "%(subformat)t": 
 
short formatted by DateFormat.SHORT
medium formatted by DateFormat.MEDIUM
long formatted by DateFormat.LONG
full formatted by DateFormat.FULL
24 dd/MM./yy hh/mm/ss
SimpleDateFormat string used to contruct to SimpleDateFormat
 
%r Relative time since the start of the program.  Also see log.time.relative.  The following sub formats are allowed in the form "%(subformat)r
 
clock The relative time converted to hh:mm:ss format.
days The relative number of days since the start of the program.
hours The relative number of hours since the start of the program
minutes The relative number of minutes since the start of the program.
seconds The relative number of seconds since the start of the program.
 
%e Event type (error, warning, notice, trace, etc). 
%h Thread group(s) and name.  Also see log.thread.format.  The following sub formats are allowed in the form "%(subformat)h": 
 
%n Writes the name of the thread that created the event
%g Writes the parent group name of the the thread that created the event.
%G Writes all the group names separated by puncuation-char.
%puncuation-char Sets the delimiter character used by %G.
plain-text This format my be interspersed with plain text.
 
%n Event sequence number
%c Class name whence the event was produced
%f Function name whence the event was produced
%F File name whence the event was produced
%l Line number in file at which the event was produced
%m Message specified by caller.  Also see log.message.format.  The following sub formats are allowed in the form "%(subformat)m".  Note, in this case, the subformat will not be used at all if the message text is null.  This allows the user to implement a kind of conditional format based on whether a message was given or not.
 
%m Writes the message text.
plain-text This format may be interspersed with plain text. 
 
%o Object specified by caller.  Also see log.object.format. The following sub formats are allowed in the form "%(subformat)o".  Note, in this case, the subformat will not be used at all if the object is null.  This allows the user to implement a kind of conditional format based on whether an object was given or not.
 
%o The object is written in its default formatting.
%l The object is written in short Lisp format (see grace.io.LispPrintWriter)
%L The object is written in pretty Lisp format (see grace.io.LispPrintWriter)
%j The object is written in short Java format (see grace.io.JavaPrintWriter)
%J The object is written in pretty Java format (see grace.io.JavaPrintWriter)
plain-text This format may be interspersed with plain text.
 
\n Inserts a newline.
\t Inserts a tab character.
 
Default Value: %t(%r):%n: %e: %h: %c.%f:%l%(: %m)m%(: %j)o\n\n
Example Usage:
$ java -Dlog.format="%t %e %(: %m)" ... This will print the absolute time and, if a message was specified, a colon and the message. 

03/01/99 17:15:38 trace
03/01/99 17:15:38 warning: Example of warning(message)
03/01/99 17:15:38 error: Example of error(message)

$ java -Dlog.format="%t %e %(%/ %G->%n)" ... This will print the time, event type, and the the hierarchy of thread group names separated by a '/' and the thread name separated by a '->'. 

03/01/99 17:21:32 trace system/main->Test-Thread.1
03/01/99 17:21:32 warning system/main->Test-Thread.1
03/01/99 17:21:32 error system/main->Test-Thread.1