com.stc.connector.sagadapter.util
Class JDKLogFormatter
java.lang.Object
java.util.logging.Formatter
com.stc.connector.sagadapter.util.JDKLogFormatter
public class JDKLogFormatter
- extends java.util.logging.Formatter
Provides a formatter for JDK logger (java.util.logging.Logger).
It will produce a simple output in format:
Timestamp(yyyyMMdd:HHmmss.SSS)|Thread(threadName)|(logLevel)|(loggerName)[(logMessage)]
(newLine)[(stackTrace) if Throwable is present.]
This class can be used in one of following ways:
1. In log configuration file (logging.properties), set property for corresponding handlers, e.g.
java.util.logging.ConsoleHandler.formatter = com.stc.connector.sagadapter.util.JDKLogFormatter
2. Dynamically set the formatter for corresponding handlers, e.g.
XXXHandler handler = new XXXHandler(...);
handler.setFormatter(new com.stc.connector.sagadapter.util.JDKLogFormatter());
handler.setLevel(Level.yyy);
java.util.logging.Logger logger = java.util.logging.Logger.getLogger("some.logger");
logger.addHandler(handler);
logger.setLevel(Level.yyy);
- Version:
- cvs revision: $Revision: 1.1 $ Last Modified: $Date: 2007/12/12 00:08:38 $
- Author:
- Harry Liu (harry.liu@sun.com)
Method Summary |
java.lang.String |
format(java.util.logging.LogRecord record)
|
Methods inherited from class java.util.logging.Formatter |
formatMessage, getHead, getTail |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JDKLogFormatter
public JDKLogFormatter()
- Constructor
format
public java.lang.String format(java.util.logging.LogRecord record)
- Specified by:
format
in class java.util.logging.Formatter
- See Also:
Formatter.format(java.util.logging.LogRecord)
Copyright © 2008 Sun Microsystems, Inc. All rights reserved.