public class LoggingUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static CentralLogger |
LOG
Logger.
|
private static java.lang.String |
PLACEHOLDER_PID
The placeholder for process id.
|
static java.lang.String |
SORTABLE_DATETIME_FORMAT
Format for file names with sortable datetime to the seconds.
|
private static java.lang.String |
VAR_PLACEHOLDER_END
The characters at the end of a placeholder for var.
|
private static java.lang.String |
VAR_PLACEHOLDER_START
The characters at the start of a placeholder for var.
|
| Constructor and Description |
|---|
LoggingUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
addLeadingSymbols(java.lang.String originalValue,
int totalCharsCount,
char symbol)
Format a text by adding leading symbols up to the defined amount of characters.
|
static java.lang.String |
addLeadingZeros(java.lang.Integer number,
int totalCharsCount)
Format a number by adding leading zeros up to the defined amount of characters.
|
static boolean |
canWriteToPath(java.lang.String filePath)
Return if the process can write to the file path.
|
(package private) static java.util.Optional<java.util.logging.Level> |
convertToLevel(java.lang.Integer levelInt)
Utility method to convert integer to java.util.logging.Level.
|
static java.util.Optional<java.util.logging.Level> |
convertToLevel(java.lang.String levelString)
Utility method to convert string to java.util.logging.Level.
|
static java.lang.String |
formatNow()
Format the current datetime.
|
private static java.lang.String |
getFirstBetween(java.lang.String text,
java.lang.String start,
java.lang.String end)
Returns the content between the starting and the ending string.
|
static java.lang.String |
replaceFormatterDateTime(java.lang.String filePath)
Return the formatted log file path.
|
static java.lang.String |
resolveLogFile(java.lang.String logFile,
java.util.function.Supplier<java.lang.Long> processIdSupplier,
java.lang.String processType,
boolean isRotationDisabled)
Returns the resolved log file name.
|
static java.lang.String |
resolveLogFile(java.lang.String logFile,
java.util.function.Supplier<java.lang.Long> processIdSupplier,
java.lang.String processType,
java.lang.String databaseName,
boolean isRotationDisabled)
Returns the resolved log file name.
|
static java.lang.String |
resolveLogFile(java.lang.String logFile,
java.util.function.Supplier<java.lang.Long> processIdSupplier,
java.lang.String userOS,
java.lang.String userFwd,
java.lang.String appServerName,
java.lang.String mode,
java.lang.String databaseName,
boolean isRotationDisabled)
Returns the resolved log file name.
|
public static final java.lang.String SORTABLE_DATETIME_FORMAT
private static final java.lang.String PLACEHOLDER_PID
private static final java.lang.String VAR_PLACEHOLDER_START
private static final java.lang.String VAR_PLACEHOLDER_END
private static final CentralLogger LOG
public static java.lang.String resolveLogFile(java.lang.String logFile,
java.util.function.Supplier<java.lang.Long> processIdSupplier,
java.lang.String processType,
boolean isRotationDisabled)
logFile - File path for the log.processIdSupplier - Supploer for the process Id.processType - Client, server, whatever you like.isRotationDisabled - Flag to indicate rotation has been disabled.public static java.lang.String resolveLogFile(java.lang.String logFile,
java.util.function.Supplier<java.lang.Long> processIdSupplier,
java.lang.String processType,
java.lang.String databaseName,
boolean isRotationDisabled)
logFile - File path for the log.processIdSupplier - Supploer for the process Id.processType - Client, server, whatever you like.databaseName - The name of the database in use.isRotationDisabled - Flag to indicate rotation has been disabled.public static java.lang.String resolveLogFile(java.lang.String logFile,
java.util.function.Supplier<java.lang.Long> processIdSupplier,
java.lang.String userOS,
java.lang.String userFwd,
java.lang.String appServerName,
java.lang.String mode,
java.lang.String databaseName,
boolean isRotationDisabled)
logFile - File path for the log.processIdSupplier - Supploer for the process Id.userOS - Operating system user.userFwd - FWD context user.appServerName - AppServer name.mode - Client, server, whatever you like.databaseName - The name of the database in use.isRotationDisabled - Flag to indicate rotation has been disabled.public static java.lang.String formatNow()
public static java.lang.String replaceFormatterDateTime(java.lang.String filePath)
filePath - File path for the log.public static boolean canWriteToPath(java.lang.String filePath)
filePath - File path for the log.true if the process can write to the file path, false otherwise.public static java.util.Optional<java.util.logging.Level> convertToLevel(java.lang.String levelString)
Level.parse(String) that throws exceptions with invalid values.levelString - The string representation of the level.static java.util.Optional<java.util.logging.Level> convertToLevel(java.lang.Integer levelInt)
Level.parse(String) that throws exceptions with invalid values.levelInt - The integer representation of the level.private static java.lang.String getFirstBetween(java.lang.String text,
java.lang.String start,
java.lang.String end)
text - The text to search in.start - The wrapper start. To be excluded.end - The wrapper end. To be excluded.public static java.lang.String addLeadingZeros(java.lang.Integer number,
int totalCharsCount)
number - The number to format.totalCharsCount - File path for the log.public static java.lang.String addLeadingSymbols(java.lang.String originalValue,
int totalCharsCount,
char symbol)
originalValue - The value to format.totalCharsCount - File path for the log.symbol - The character to use for filling in leading spaces.