public final class ThreadLogger extends Object
Modifier and Type | Method and Description |
---|---|
static String |
getFormattedDeadlockInfo(String prefix)
Same as
getFormattedDeadlockInfo(prefix, "\n\t", "\n\t\t") . |
static String |
getFormattedDeadlockInfo(String prefix,
String threadPrefix,
String stackElementPrefix)
Produces a String representation of threads that are deadlocked, including lock information.
|
static String |
getFormattedThreadList(String prefix)
Same as
getFormattedThreadList(prefix, "\n\t", "\n\t\t") . |
static String |
getFormattedThreadList(String prefix,
String threadPrefix,
String stackElementPrefix)
Produces a String representation of the currently running threads.
|
static void |
logThreads(Logger logger,
Level level,
String prefix)
Same as
logThreads(logger, level, prefix, "\n\t", "\n\t\t") . |
static void |
logThreads(Logger logger,
Level level,
String prefix,
String threadPrefix,
String stackElementPrefix)
Logs the currently active threads and their stack trace to the given Logger and Level.
|
static void |
main(String[] args)
An example how to use the above methods.
|
public static void logThreads(Logger logger, Level level, String prefix)
logThreads(logger, level, prefix, "\n\t", "\n\t\t")
.public static void logThreads(Logger logger, Level level, String prefix, String threadPrefix, String stackElementPrefix)
logger
- the Logger instance to log to.level
- the Level to log into.prefix
- a prefix of the log message.threadPrefix
- logged before each thread, e.g. "\n\t" to create an indented list.stackElementPrefix
- logged before each stack trace element, e.g. "\n\t\t" to create an indented list.public static String getFormattedThreadList(String prefix, String threadPrefix, String stackElementPrefix)
prefix
- The prefix of the string returned.threadPrefix
- Printed before each thread, e.g. "\n\t" to create an indented list.stackElementPrefix
- Printed before each stack trace element, e.g. "\n\t\t" to create an indented list.public static String getFormattedThreadList(String prefix)
getFormattedThreadList(prefix, "\n\t", "\n\t\t")
.public static String getFormattedDeadlockInfo(String prefix, String threadPrefix, String stackElementPrefix)
prefix
- The prefix of the string returned.threadPrefix
- Printed before each thread, e.g. "\n\t" to create an indented list.stackElementPrefix
- Printed before each stack trace element, e.g. "\n\t\t" to create an indented list.public static String getFormattedDeadlockInfo(String prefix)
getFormattedDeadlockInfo(prefix, "\n\t", "\n\t\t")
.Copyright © 2017 The Apache Software Foundation. All rights reserved.