com.sun.sgs.impl.sharedutil.logging
Class LogFormatter

java.lang.Object
  extended by java.util.logging.Formatter
      extended by com.sun.sgs.impl.sharedutil.logging.LogFormatter

public class LogFormatter
extends Formatter

Defines a logging Formatter that uses a compact date and time format that includes milliseconds, permits the date and time format to be customized, and allows suppressing stack traces for exceptions.

This class recognizes the following LogManager configuration properties:

Property: "com.sun.sgs.impl.sharedutil.logging.LogFormatter.time.format"
Default: "%tF %1$tT.%1$tL"
Specifies the format string that will be used in a call to Formatter.format to display the date and time of a logging call. The argument to the format call will be a long representing the current time in milliseconds. The default prints the time in the format 2008-02-14 11:52:59.679.

Property: "com.sun.sgs.impl.sharedutil.logging.LogFormatter.print.stack"
Default: true
Specifies whether to print stack traces when formatting a log record that contains an exception.

For example, to use this class to format logging output to the console so that it prints the time in milliseconds since the epoch and does not include stack traces, put the following text in the logging configuration file:

   .level=INFO
   handlers=java.util.logging.ConsoleHandler
   java.util.logging.ConsoleHandler.formatter=com.sun.sgs.impl.sharedutil.logging.LogFormatter
   com.sun.sgs.impl.sharedutil.logging.LogFormatter.time.format=%tQ
   com.sun.sgs.impl.sharedutil.logging.LogFormatter.print.stack=false
 


Field Summary
static String DEFAULT_TIME_FORMAT
          The default time format string.
static String PRINT_STACK_PROPERTY
          The logging property for specifying whether to print stack traces when logging a thrown exception.
static String TIME_FORMAT_PROPERTY
          The logging property for specifying the time format.
 
Constructor Summary
LogFormatter()
          Creates an instance of this class.
 
Method Summary
 String format(LogRecord record)
          
 
Methods inherited from class java.util.logging.Formatter
formatMessage, getHead, getTail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIME_FORMAT

public static final String DEFAULT_TIME_FORMAT
The default time format string.

See Also:
Constant Field Values

TIME_FORMAT_PROPERTY

public static final String TIME_FORMAT_PROPERTY
The logging property for specifying the time format.

See Also:
Constant Field Values

PRINT_STACK_PROPERTY

public static final String PRINT_STACK_PROPERTY
The logging property for specifying whether to print stack traces when logging a thrown exception.

See Also:
Constant Field Values
Constructor Detail

LogFormatter

public LogFormatter()
Creates an instance of this class.

Method Detail

format

public String format(LogRecord record)

Specified by:
format in class Formatter

Project Darkstar, Version 0.9.9.4
2013-07-29 20:49:18

Copyright © 2007-2013 Sun Microsystems, Inc. All rights reserved