System.Logger that forwards all messages to an underlying
System.Logger, after adding some decoration. The logger also has the
ability to additionally send the logged messages to System.err or System.out,
whether the underlying logger is activated or not. In addition instance of
DebugLogger support both String#format(String, Object...) and
java.text.MessageFormat#format(String, Object...) formatting.
String-like formatting is enabled by the presence of "%s" or "%d" in the
format string. MessageFormat-like formatting is enabled by the presence of
"{0" or "{1".
See Utils#getDebugLogger(Supplier) and
Utils#getHpackLogger(Supplier).
| Modifier and Type | Class and Description |
|---|---|
| public static record | DebugLogger.
A DebugLogger configuration is composed of three levels. |
| Modifier and Type | Field and Description |
|---|---|
| private final DebugLogger. | |
| private final Supplier | |
| private final boolean | |
| pack-priv static final System. | |
| pack-priv static final String | |
| pack-priv static final System. | |
| pack-priv static final String | |
| private final System. | |
| private final int | |
| private static final DebugLogger | |
| private static final DebugLogger | |
| private static final DebugLogger | |
| pack-priv static final long | |
| private final boolean | |
| pack-priv static final System. | |
| pack-priv static final String |
| Access | Constructor and Description |
|---|---|
| private | DebugLogger(System.
A lambda that returns a string that identifies the caller
(e.g: "SocketTube(3)", or "Http2Connection(SocketTube(3))") dbgTag, DebugLogger.The levels at or above which messages will be printed to the
corresponding destination. configCreate a logger for debug traces.The logger should only be used
with levels whose severity is |
| Modifier and Type | Method and Description |
|---|---|
| public static DebugLogger | |
| public static DebugLogger | |
| public static DebugLogger | |
| private StringBuilder | |
| private StringBuilder | |
| public String | |
| private boolean | |
| public boolean | isLoggable(System.
Implements java. Checks if a message of the given level would be logged by this logger. |
| private static boolean | |
| public void | log(System.
Implements java. Logs a message with resource bundle and an optional list of parameters. |
| public void | log(System.
Implements java. Logs a localized message associated with a given throwable. |
| public final boolean | |
| private void | |
| private boolean |
| config | back to summary |
|---|---|
| private final DebugLogger. | |
| dbgTag | back to summary |
|---|---|
| private final Supplier<String> dbgTag | |
| debugOn | back to summary |
|---|---|
| private final boolean debugOn | |
| HPACK | back to summary |
|---|---|
| pack-priv static final System. | |
| HPACK_NAME | back to summary |
|---|---|
| pack-priv static final String HPACK_NAME | |
| HTTP | back to summary |
|---|---|
| pack-priv static final System. | |
| HTTP_NAME | back to summary |
|---|---|
| pack-priv static final String HTTP_NAME | |
| logger | back to summary |
|---|---|
| private final System. | |
| minSeverity | back to summary |
|---|---|
| private final int minSeverity | |
| NO_HPACK_LOGGER | back to summary |
|---|---|
| private static final DebugLogger NO_HPACK_LOGGER | |
| NO_HTTP_LOGGER | back to summary |
|---|---|
| private static final DebugLogger NO_HTTP_LOGGER | |
| NO_WS_LOGGER | back to summary |
|---|---|
| private static final DebugLogger NO_WS_LOGGER | |
| START_NANOS | back to summary |
|---|---|
| pack-priv static final long START_NANOS | |
| traceOn | back to summary |
|---|---|
| private final boolean traceOn | |
| WS | back to summary |
|---|---|
| pack-priv static final System. | |
| WS_NAME | back to summary |
|---|---|
| pack-priv static final String WS_NAME | |
| DebugLogger | back to summary |
|---|---|
| private DebugLogger(System. Create a logger for debug traces.The logger should only be used
with levels whose severity is
By default, this logger will print message whose severity is
above the severity configured in the logger
The logger will add some decoration to the printed message, in the form of
API Note To obtain a logger that will always print things on stderr in
addition to forwarding to the internal logger, use
| |
| createHpackLogger | back to summary |
|---|---|
| public static DebugLogger createHpackLogger(Supplier<String> dbgTag, DebugLogger. | |
| createHttpLogger | back to summary |
|---|---|
| public static DebugLogger createHttpLogger(Supplier<String> dbgTag, DebugLogger. | |
| createWebSocketLogger | back to summary |
|---|---|
| public static DebugLogger createWebSocketLogger(Supplier<String> dbgTag, DebugLogger. | |
| decorate | back to summary |
|---|---|
| private StringBuilder decorate(StringBuilder sb, String msg) | |
| format | back to summary |
|---|---|
| private StringBuilder format(StringBuilder sb, String format, Object[] params) | |
| getName | back to summary |
|---|---|
| public String getName() Implements java. Doc from java. Returns the name of this logger.
| |
| isEnabled | back to summary |
|---|---|
| private boolean isEnabled(System. | |
| isLoggable | back to summary |
|---|---|
| public boolean isLoggable(System. Implements java. Doc from java. Checks if a message of the given level would be logged by this logger.
| |
| levelEnabledFor | back to summary |
|---|---|
| private static boolean levelEnabledFor(System. | |
| log | back to summary |
|---|---|
| public void log(System. Implements java. Doc from java. Logs a message with resource bundle and an optional list of
parameters.
If the given resource bundle is non-
| |
| log | back to summary |
|---|---|
| public void log(System. Implements java. Doc from java. Logs a localized message associated with a given throwable.
If the given resource bundle is non-
| |
| on | back to summary |
|---|---|
| public final boolean on() Overrides default jdk. Doc from jdk. Tells whether this logger is on.
| |
| back to summary | |
|---|---|
| private void print(PrintStream out, System. | |
| useStringFormat | back to summary |
|---|---|
| private boolean useStringFormat(String format) | |
System#out
System#err
System.Logger
| Modifier and Type | Field and Description |
|---|---|
| private final System. | errLevel
Record Component accessed by errLevel(). the level at or above which messages will be directly printed toSystem#err
|
| public static final DebugLogger. | ERRLOG
logs on both System.err and System.Logger |
| public static final DebugLogger. | ERROUT
logs on both System.err and System.out |
| public static final DebugLogger. | LOG
Forward to System.Logger, doesn't log directly to System.out or System.err |
| private final System. | logLevel
Record Component accessed by logLevel(). the level at or above which messages will be forwarded to an underlyingSystem.
|
| public static final DebugLogger. | OFF
does not log anywhere |
| private final System. | outLevel
Record Component accessed by outLevel(). the level at or above which messages will be directly printed toSystem#out
|
| public static final DebugLogger. | STDERR
Logs on |
| public static final DebugLogger. | STDOUT
Logs on |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public System. | errLevel()
Record Component getter of errLevel.
Record Component
the level at or above which messages will be directly
printed to |
| public final int | |
| public boolean | |
| public System. | logLevel()
Record Component getter of logLevel.
Record Component
the level at or above which messages will be forwarded
to an underlying |
| public int | |
| public static DebugLogger. | |
| public boolean | |
| public System. | outLevel()
Record Component getter of outLevel.
Record Component
the level at or above which messages will be directly
printed to |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| public DebugLogger. | |
| public DebugLogger. | |
| public DebugLogger. |
| errLevel | back to summary |
|---|---|
| private final System. Record Component accessed by errLevel(). the level at or above which messages will be directly
printed to | |
| ERRLOG | back to summary |
|---|---|
| public static final DebugLogger. logs on both System.err and System.Logger | |
| ERROUT | back to summary |
|---|---|
| public static final DebugLogger. logs on both System.err and System.out | |
| LOG | back to summary |
|---|---|
| public static final DebugLogger. Forward to System.Logger, doesn't log directly to System.out or System.err | |
| logLevel | back to summary |
|---|---|
| private final System. Record Component accessed by logLevel(). the level at or above which messages will be forwarded
to an underlying | |
| OFF | back to summary |
|---|---|
| public static final DebugLogger. does not log anywhere | |
| outLevel | back to summary |
|---|---|
| private final System. Record Component accessed by outLevel(). the level at or above which messages will be directly
printed to | |
| STDERR | back to summary |
|---|---|
| public static final DebugLogger. Logs on | |
| STDOUT | back to summary |
|---|---|
| public static final DebugLogger. Logs on | |
| LoggerConfig | back to summary |
|---|---|
| public LoggerConfig(System. | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| errLevel | back to summary |
|---|---|
| public System. Record Component getter of errLevel.
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| levelEnabledFor | back to summary |
|---|---|
| public boolean levelEnabledFor(System. | |
| logLevel | back to summary |
|---|---|
| public System. Record Component getter of logLevel.
| |
| minSeverity | back to summary |
|---|---|
| public int minSeverity() | |
| of | back to summary |
|---|---|
| public static DebugLogger. | |
| on | back to summary |
|---|---|
| public boolean on() | |
| outLevel | back to summary |
|---|---|
| public System. Record Component getter of outLevel.
| |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |
| withErrLevel | back to summary |
|---|---|
| public DebugLogger. | |
| withLogLevel | back to summary |
|---|---|
| public DebugLogger. | |
| withOutLevel | back to summary |
|---|---|
| public DebugLogger. | |