| java.lang.Object | |
| ↳ | com.google.gdata.util.common.logging.FormattingLogger |
A wrapped logger chock-full of convenience methods. The introduction of varargs in Java 5 has provided two ways to further simplify logging information.
First, the level-based convenience methods such asLogger.foo(String msg) can contain an additional
Object... args parameter that formats your message according to the
logger's java.util.logging.Formatter.
Second, for those times when you don't want the
java.util.logging.Formatter to manage formatting your message, you
can use the FormattingLogger.xxxfmt(String fmt, Object... params)
methods. These methods leverage the Java 5
String#format(String format, Object... args) method. However,
logger.infofmt("%s %s", foo, bar) is slightly more efficient than
logger.info(String.format("%s %s", foo, bar)) since the text is
only formatted when the message is sufficiently important. It's also a little
more readable.
Keep in mind that this class mixes two ways to format text: one that expects
text to be formatted by the logger's java.util.logging.Formatter
and one that depends upon the new
format(java.lang.String, java.lang.Object[]) style.
If, in this class, method name ends with fmt, it's formatting using
the latter. If the class method does not end with fmt, it's using
the traditional formatting style.
NOTE(future extenders): any time a new logfmt(Level, String, Object...) variant is added
to this class a matching logpfmt(Level, String, String, String, Object...) variant must also be added, and
vice versa. This enables com.google.monitoring.runtime.instrumentation.LogFasterer to do its job.
by calls to the private method doLog, which sets the resource bundle.
FormattingLogger does not support that yet; this functionality may change.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| FormattingLogger.Record | An extension of LogRecord used to support a custom version of
its private inferCaller(String) method. |
||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| LOGGER_CLASS_NAME | |||||||||||
| logger | |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new FormattingLogger.
| |||||||||||
Creates a new FormattingLogger.
| |||||||||||
Creates a new FormattingLogger by wrapping a
Logger. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Log a CONFIG message.
| |||||||||||
Log a CONFIG message.
| |||||||||||
Log a CONFIG message.
| |||||||||||
Log a CONFIG message.
| |||||||||||
Log a CONFIG message.
| |||||||||||
Log a FINE message.
| |||||||||||
Log a FINE message.
| |||||||||||
Log a FINE message.
| |||||||||||
Log a FINE message.
| |||||||||||
Log a FINE message.
| |||||||||||
Log a FINER message.
| |||||||||||
Log a FINER message.
| |||||||||||
Log a FINER message.
| |||||||||||
Log a FINER message.
| |||||||||||
Log a FINER message.
| |||||||||||
Log a FINEST message.
| |||||||||||
Log a FINEST message.
| |||||||||||
Log a FINEST message.
| |||||||||||
Log a FINEST message.
| |||||||||||
Log a FINEST message.
| |||||||||||
Gets the
Logger wrapped by this FormattingLogger. | |||||||||||
Pass-through to
getLevel() | |||||||||||
Returns an instance of
FormattingLogger. | |||||||||||
Returns an instance of
FormattingLogger using the
getCanonicalName() as a source for the underlying logger's
name. | |||||||||||
Log an INFO message.
| |||||||||||
Log an INFO message.
| |||||||||||
Log a INFO message.
| |||||||||||
Log an INFO message.
| |||||||||||
Log an INFO message.
| |||||||||||
Pass-through to
isLoggable(Level) | |||||||||||
Similar to
log(Level, String, Object[]), allows you to delay
formatting with java.text.MessageFormat. | |||||||||||
Similar to
log(Level, String, Throwable), sets the value
of getThrown(). | |||||||||||
Similar to
log(Level, String, Throwable), but takes
variable arguments and allows you to delay formatting with
java.text.MessageFormat. | |||||||||||
Log a java.util.logging.LogRecord.
| |||||||||||
Log a message.
| |||||||||||
Log a message.
| |||||||||||
Log a message.
| |||||||||||
Logs an event with a known context, similar to
logp(java.util.logging.Level, String, String, String, Throwable). | |||||||||||
Logs an event with a known context, similar to
logp(java.util.logging.Level, String, String, String, Throwable). | |||||||||||
Logs an event with a known context, similar to
logp(java.util.logging.Level, String, String, String). | |||||||||||
Logs an event with a known context, using explicit formatting rules.
| |||||||||||
Logs an event with a known context, using explicit formatting rules.
| |||||||||||
Logs an event with a known context, using explicit formatting rules.
| |||||||||||
Pass-through to
setLevel(Level) | |||||||||||
Log a SEVERE message.
| |||||||||||
Log a SEVERE message, with an array of object arguments.
| |||||||||||
Log a SEVERE message.
| |||||||||||
Log a SEVERE message.
| |||||||||||
Log a SEVERE message.
| |||||||||||
Log a WARNING message.
| |||||||||||
Log a WARNING message.
| |||||||||||
Log a WARNING message.
| |||||||||||
Log a WARNING message.
| |||||||||||
Log a WARNING message.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Creates a new FormattingLogger.
This is convenience ctor that creates a named backing Logger with
the name of the passed-in class.
| cls | The class whose name will be used to name the backing logger. |
|---|
Creates a new FormattingLogger.
This is a convenience ctor that creates an anonymous backing
Logger.
Creates a new FormattingLogger by wrapping a Logger.
| logger | The Logger to wrap.
|
|---|
Log a CONFIG message.
If the logger is currently enabled for the CONFIG message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the message |
Log a CONFIG message.
If the logger is currently enabled for the CONFIG message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| params | Array of parameters to the message |
Log a CONFIG message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| args | Array of parameters to the formatter |
format(java.util.Locale, String, Object[])Log a CONFIG message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| thrown | The throwable which triggered this log event |
|---|---|
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the message |
Log a CONFIG message.
If the logger currently accepts messages of the supplied level,
then the fmt and thrown are converted to a string
using format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the formatter message |
format(java.util.Locale, String, Object[])Log a FINE message.
If the logger is currently enabled for the FINE message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| params | Array of parameters to the message |
Log a FINE message.
If the logger is currently enabled for the FINE message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the message |
Log a FINE message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| args | Array of parameters to the formatter |
format(String, Object[])Log a FINE message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| thrown | The throwable which triggered this log event |
|---|---|
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the message |
Log a FINE message.
If the logger currently accepts messages of the supplied level,
then the fmt and thrown are converted to a string
using format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the formatter message |
format(String, Object[])Log a FINER message.
If the logger is currently enabled for the FINER message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| params | Array of parameters to the message |
Log a FINER message.
If the logger is currently enabled for the FINER message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the message |
Log a FINER message.
If the logger currently accepts messages of the supplied level,
then the fmt and thrown are converted to a string
using format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the formatter message |
format(String, Object[])Log a FINER message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| args | Array of parameters to the formatter |
format(String, Object[])Log a FINER message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| thrown | The throwable which triggered this log event |
|---|---|
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the message |
Log a FINEST message.
If the logger is currently enabled for the FINEST message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the message |
Log a FINEST message.
If the logger is currently enabled for the FINEST message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| params | Array of parameters to the message |
Log a FINEST message.
If the logger currently accepts messages of the supplied level,
then the fmt and thrown are converted to a string
using format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the formatter message |
format(String, Object[])Log a FINEST message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| args | Array of parameters to the formatter |
format(String, Object[])Log a FINEST message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| thrown | The throwable which triggered this log event |
|---|---|
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the message |
Gets the Logger wrapped by this FormattingLogger.
Logger wrapped by this FormattingLogger.
Returns an instance of FormattingLogger.
| name |
|---|
Returns an instance of FormattingLogger using the
getCanonicalName() as a source for the underlying logger's
name.
| cls |
|---|
Log an INFO message.
If the logger is currently enabled for the INFO message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the message |
Log an INFO message.
If the logger is currently enabled for the INFO message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| params | Array of parameters to the message |
Log a INFO message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| thrown | The throwable which triggered this log event |
|---|---|
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the message |
Log an INFO message.
If the logger currently accepts messages of the supplied level,
then the fmt and thrown are converted to a string
using format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the formatter message |
format(String, Object[])Log an INFO message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| args | Array of parameters to the formatter |
format(String, Object[])Similar to log(Level, String, Object[]), allows you to delay
formatting with java.text.MessageFormat.
| level | |
|---|---|
| msg | |
| params |
Similar to log(Level, String, Throwable), sets the value
of getThrown().
| level | |
|---|---|
| msg | |
| thrown |
Similar to log(Level, String, Throwable), but takes
variable arguments and allows you to delay formatting with
java.text.MessageFormat.
Calls setThrown(Throwable) if thrown is non-null.
| level | |
|---|---|
| thrown | |
| msg | |
| params |
Log a java.util.logging.LogRecord. The log message, level and
other parameters are contained in the LogRecord, but the source
class and method will be set if necessary.
| lr |
|---|
Log a message.
If the logger currently accepts messages of the supplied level,
then the fmt and thrown are converted to a string
using format(String, Object[])
and forwarded to all the registered output Handler objects.
| level | One of the message level identifiers, e.g. SEVERE |
|---|---|
| fmt | The string message (or a key in the message catalog) |
| thrown | The throwable which triggered this log event, and parameter to the format message |
Log a message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| level | One of the message level identifiers, e.g. SEVERE |
|---|---|
| thrown | The throwable which triggered this log event |
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the message |
Log a message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| level | One of the message level identifiers, e.g. SEVERE |
|---|---|
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the message |
Logs an event with a known context, similar to
logp(java.util.logging.Level, String, String, String, Throwable).
However, this delays formatting of the message.
| level | One of the message level identifiers, e.g. SEVERE |
|---|---|
| sourceClassName | The class generating this log event |
| sourceMethodName | The method generating this log event |
| thrown | The throwable which triggered this log event |
| msg | The basic message string |
| params | The parameters for the message string |
Logs an event with a known context, similar to
logp(java.util.logging.Level, String, String, String, Throwable).
However, this delays formatting of the message.
| level | One of the message level identifiers, e.g. SEVERE |
|---|---|
| sourceClassName | The class generating this log event |
| sourceMethodName | The method generating this log event |
| msg | The message string |
| thrown | The throwable which triggered this log event |
Logs an event with a known context, similar to
logp(java.util.logging.Level, String, String, String).
However, this delays formatting of the message.
| level | One of the message level identifiers, e.g. SEVERE |
|---|---|
| sourceClassName | The class generating this log event |
| sourceMethodName | The method generating this log event |
| msg | The basic message string |
| params | The parameters for the message string |
Logs an event with a known context, using explicit formatting rules.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| level | One of the message level identifiers, e.g. SEVERE |
|---|---|
| sourceClassName | The class generating this log event |
| sourceMethodName | The method generating this log event |
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the format message |
Logs an event with a known context, using explicit formatting rules.
If the logger currently accepts messages of the supplied level,
then the fmt and thrown are converted to a string
using format(String, Object[])
and forwarded to all the registered output Handler objects.
| level | One of the message level identifiers, e.g. SEVERE |
|---|---|
| sourceClassName | The class generating this log event |
| sourceMethodName | The method generating this log event |
| fmt | The string message (or a key in the message catalog) |
| thrown | The throwable which triggered this log event, and parameter to the format message |
Logs an event with a known context, using explicit formatting rules.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| level | One of the message level identifiers, e.g. SEVERE |
|---|---|
| sourceClassName | The class generating this log event |
| sourceMethodName | The method generating this log event |
| thrown | The throwable which triggered this log event |
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the message |
Log a SEVERE message.
If the logger is currently enabled for the SEVERE message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the message |
Log a SEVERE message, with an array of object arguments.
If the logger is currently enabled for the SEVERE message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| params | Array of parameters to the message |
Log a SEVERE message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| args | Array of parameters to the formatter |
format(String, Object[])Log a SEVERE message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| thrown | The throwable which triggered this log event |
|---|---|
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the message |
Log a SEVERE message.
If the logger currently accepts messages of the supplied level,
then the fmt and thrown are converted to a string
using format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the formatter message |
format(String, Object[])Log a WARNING message.
If the logger is currently enabled for the WARNING message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| params | Array of parameters to the message |
Log a WARNING message.
If the logger is currently enabled for the WARNING message level then the given message is forwarded to all the registered output Handler objects.
| msg | The string message (or a key in the message catalog) |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the message |
Log a WARNING message.
If the logger currently accepts messages of the supplied level,
then the fmt and thrown are converted to a string
using format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| thrown | The throwable which triggered this log event, and parameter to the formatter message |
format(String, Object[])Log a WARNING message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and forwarded to all the registered output Handler objects.
| thrown | The throwable which triggered this log event |
|---|---|
| fmt | The string message (or a key in the message catalog) |
| args | Array of parameters to the message |
Log a WARNING message.
If the logger currently accepts messages of the supplied level,
then the fmt and args are converted to a string using
format(String, Object[])
and is forwarded to all the registered output Handler objects.
| fmt | A format string |
|---|---|
| args | Array of parameters to the formatter |
format(String, Object[])