@ThreadSafe public final class LogUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_TRUNCATED_LENGTH
The truncated length for a message line.
|
Modifier and Type | Method and Description |
---|---|
static LogInfo |
setLogLevel(String logName,
String level)
Gets a logger's level with specify name, if the level argument is not null, it will set to
specify level first.
|
static String |
truncateMessageLineLength(Object message)
Truncates each line of a message to a certain length.
|
static String |
truncateMessageLineLength(Object message,
int maxLineLength)
Truncates each line of a message to a certain length.
|
static void |
warnWithException(org.slf4j.Logger logger,
String message,
Object... args)
Log a warning message with full exception if debug logging is enabled,
or just the exception string otherwise.
|
public static final int MAX_TRUNCATED_LENGTH
public static LogInfo setLogLevel(String logName, String level) throws IOException
logName
- logger's namelevel
- logger's levelIOException
- if an I/O error occurspublic static void warnWithException(org.slf4j.Logger logger, String message, Object... args)
logger
- the logger to be usedmessage
- the message to be loggedargs
- the arguments for the messagepublic static String truncateMessageLineLength(Object message)
message
- the message to truncate the lines forMAX_TRUNCATED_LENGTH
public static String truncateMessageLineLength(Object message, int maxLineLength)
message
- the message to truncate the lines formaxLineLength
- the maximum length of a message lineCopyright © 2023. All Rights Reserved.