| Modifier and Type | Field and Description |
|---|---|
| private final Map | children
The child nodes of this log node. |
| private static final SimpleDateFormat | dateTimeFormatter
The date/time formatter (not threadsafe). |
| private long | elapsedTimeNanos
The time between when this log entry was created and addElapsedTime() was called. |
| private static final Logger | log
The logger. |
| private static boolean | logInRealtime
If true, log entries are output in realtime, as well as added to the LogNode tree. |
| private final String | msg
The log message. |
| private static final DecimalFormat | nanoFormatter
The elapsed time formatter. |
| private LogNode | parent
The parent LogNode. |
| private final String | sortKeyPrefix
The sort key prefix for deterministic ordering of log entries. |
| private static AtomicInteger | sortKeyUniqueSuffix
The sort key suffix for this log entry, used to make sort keys unique. |
| private String | stackTrace
The stacktrace, if this log entry was due to an exception. |
| private final long | timeStampMillis
The timestamp at which the log node was created, in epoch millis. |
| private final long | timeStampNano
The timestamp at which the log node was created (relative to some arbitrary system timepoint). |
| Access | Constructor and Description |
|---|---|
| private | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private LogNode | |
| private LogNode | |
| private LogNode | |
| public void | addElapsedTime()
Call this once the work corresponding with a given log entry has completed if you want to show the time taken after the log entry. |
| private void | appendLine(final String
the timestamp string timeStampStr, final int the indent level indentLevel, final String the line to log line, final StringBuilder the buf buf)Append a line to the log output, indenting this log entry according to tree structure. |
| public void | |
| public LogNode | Returns: a child log node, which can be used to add sub-entries.The sort key for the log entry. sortKey, final String The message. msg, final long The elapsed time. elapsedTimeNanos, final Throwable The e)Throwable that was thrown.Add a log entry with sort key for deterministic ordering. |
| public LogNode | |
| public LogNode | |
| public LogNode | |
| public LogNode | |
| public LogNode | |
| public LogNode | |
| public LogNode | |
| public LogNode | Returns: the last log node created, which can be used to add sub-entries.The messages. msgs)Add a series of log entries. |
| public LogNode | |
| public static void | logInRealtime(final boolean
whether to log in realtime logInRealtime)If logInRealtime is true, log entries are output in realtime, as well as added to the LogNode tree. |
| private void | |
| private void | toString(final int
the indent level indentLevel, final StringBuilder the buf buf)Recursively build the log output. |
| public String |
| children | back to summary |
|---|---|
| private final Map<String, LogNode> children The child nodes of this log node. | |
| dateTimeFormatter | back to summary |
|---|---|
| private static final SimpleDateFormat dateTimeFormatter The date/time formatter (not threadsafe). | |
| elapsedTimeNanos | back to summary |
|---|---|
| private long elapsedTimeNanos The time between when this log entry was created and addElapsedTime() was called. | |
| log | back to summary |
|---|---|
| private static final Logger log The logger. | |
| logInRealtime | back to summary |
|---|---|
| private static boolean logInRealtime If true, log entries are output in realtime, as well as added to the LogNode tree. | |
| msg | back to summary |
|---|---|
| private final String msg The log message. | |
| nanoFormatter | back to summary |
|---|---|
| private static final DecimalFormat nanoFormatter The elapsed time formatter. | |
| parent | back to summary |
|---|---|
| private LogNode parent The parent LogNode. | |
| sortKeyPrefix | back to summary |
|---|---|
| private final String sortKeyPrefix The sort key prefix for deterministic ordering of log entries. | |
| sortKeyUniqueSuffix | back to summary |
|---|---|
| private static AtomicInteger sortKeyUniqueSuffix The sort key suffix for this log entry, used to make sort keys unique. | |
| stackTrace | back to summary |
|---|---|
| private String stackTrace The stacktrace, if this log entry was due to an exception. | |
| timeStampMillis | back to summary |
|---|---|
| private final long timeStampMillis The timestamp at which the log node was created, in epoch millis. | |
| timeStampNano | back to summary |
|---|---|
| private final long timeStampNano The timestamp at which the log node was created (relative to some arbitrary system timepoint). | |
| LogNode | back to summary |
|---|---|
| private LogNode(final String sortKey, final String msg, final long elapsedTimeNanos, final Throwable exception) Create a non-toplevel log node. The order may also be made deterministic by specifying a sort key for log entries. | |
| LogNode | back to summary |
|---|---|
| public LogNode() Create a toplevel log node. | |
| addChild | back to summary |
|---|---|
| private LogNode addChild(final String sortKey, final String msg, final long elapsedTimeNanos, final Throwable exception) Add a child log node. | |
| addChild | back to summary |
|---|---|
| private LogNode addChild(final String sortKey, final String msg, final long elapsedTimeNanos) Add a child log node for a message. | |
| addChild | back to summary |
|---|---|
| private LogNode addChild(final Throwable exception) Add a child log node for an exception. | |
| addElapsedTime | back to summary |
|---|---|
| public void addElapsedTime() Call this once the work corresponding with a given log entry has completed if you want to show the time taken after the log entry. | |
| appendLine | back to summary |
|---|---|
| private void appendLine(final String timeStampStr, final int indentLevel, final String line, final StringBuilder buf) Append a line to the log output, indenting this log entry according to tree structure.
| |
| flush | back to summary |
|---|---|
| public void flush() Flush out the log to stderr, and clear the log contents. Only call this on the toplevel log node, when threads do not have access to references of internal log nodes so that they cannot add more log entries inside the tree, otherwise log entries may be lost. | |
| log | back to summary |
|---|---|
| public LogNode log(final String sortKey, final String msg, final long elapsedTimeNanos, final Throwable e) Add a log entry with sort key for deterministic ordering. | |
| log | back to summary |
|---|---|
| public LogNode log(final String sortKey, final String msg, final long elapsedTimeNanos) Add a log entry with sort key for deterministic ordering. | |
| log | back to summary |
|---|---|
| public LogNode log(final String sortKey, final String msg, final Throwable e) Add a log entry with sort key for deterministic ordering. | |
| log | back to summary |
|---|---|
| public LogNode log(final String sortKey, final String msg) Add a log entry with sort key for deterministic ordering. | |
| log | back to summary |
|---|---|
| public LogNode log(final String msg, final long elapsedTimeNanos, final Throwable e) Add a log entry. | |
| log | back to summary |
|---|---|
| public LogNode log(final String msg, final long elapsedTimeNanos) Add a log entry. | |
| log | back to summary |
|---|---|
| public LogNode log(final String msg, final Throwable e) Add a log entry. | |
| log | back to summary |
|---|---|
| public LogNode log(final String msg) Add a log entry. | |
| log | back to summary |
|---|---|
| public LogNode log(final Collection<String> msgs) Add a series of log entries. Returns the last LogNode created.
| |
| log | back to summary |
|---|---|
| public LogNode log(final Throwable e) Add a log entry. | |
| logInRealtime | back to summary |
|---|---|
| public static void logInRealtime(final boolean logInRealtime) If logInRealtime is true, log entries are output in realtime, as well as added to the LogNode tree. This can help debug situations where log info is never shown, e.g. deadlocks, or where you need to show the log info right up to the point where you hit a breakpoint.
| |
| logJavaInfo | back to summary |
|---|---|
| private void logJavaInfo() Log the Java version and the JRE paths that were found. | |
| toString | back to summary |
|---|---|
| private void toString(final int indentLevel, final StringBuilder buf) Recursively build the log output.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Build the log output. Call this on the toplevel log node. | |