Top Description Inners Fields Constructors Methods
org.jboss.logmanager.formatters

public final Class Formatters

extends Object
Class Inheritance
Annotations
@SuppressWarnings:WeakerAccess, unused
Static Imports
java.lang.Math.max, .Math.min, java.security.AccessController.doPrivileged

Formatter utility methods.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
pack-priv static class
private abstract static class

Field Summary

Modifier and TypeField and Description
private static final boolean
private static final String
private static final Formatter
private static final Pattern
private static final String
public static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static String

Returns:

the substring
applySegments
(final int
the maximum number of segments to include
count
,
final String
the subject string
subject
)

Apply up to count trailing segments of the given string to the given builder.

private static String

Returns:

the substring
applySegments
(final String
the precision used to
precision
,
final String
the subject string
subject
)

Apply up to precision trailing segments of the given string to the given builder.

public static FormatStep

Returns:

the format step
classNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final String
the argument used for the class name, may be null or contain dots to format the class name
precision
)

Create a format step which emits the source class name with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
classNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final String
the argument used for the class name, may be null or contain dots to format the class name
precision
)

Create a format step which emits the source class name with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
dateFormatStep
(final TimeZone
the time zone to format to
timeZone
,
final String
the date format string
formatString
,
final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the date of the log record with the given justification rules.

public static FormatStep

Returns:

the format step
dateFormatStep
(final TimeZone
the time zone to format to
timeZone
,
final String
the date format string
formatString
,
final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the date of the log record with the given justification rules.

public static FormatStep

Returns:

the format step
dateFormatStep
(final String
the date format string
formatString
,
final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the date of the log record with the given justification rules.

private static void
doExceptionFormatStep(final StringBuilder builder, final ExtLogRecord record, final String argument, final boolean extended)

public static FormatStep

Returns:

the format step
exceptionFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final boolean
true if the stack trace should attempt to include extended JAR version information
extended
)

Create a format step which emits the stack trace of an exception with the given justification rules.

public static FormatStep

Returns:

the format step
exceptionFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final String argument, final boolean
true if the stack trace should attempt to include extended JAR version information
extended
)

Create a format step which emits the stack trace of an exception with the given justification rules.

public static FormatStep

Returns:

the format step
fileNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the source file name with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
fileNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the source file name with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep
formatColor(final ColorMap colors, final String color)

public static FormatStep

Returns:

the format step
hostnameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final boolean
true to use the fully qualified host name, false to only use the
qualified
)

Create a format step which emits the hostname.

public static FormatStep

Returns:

the format step
hostnameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final String
the argument used for the class name, may be null or contain dots to format the class name
precision
)

Create a format step which emits the hostname.

public static FormatStep

Returns:

the format step
levelFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the log level name.

public static FormatStep

Returns:

the format step
levelFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the log level name.

public static FormatStep

Returns:

the format step
lineNumberFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the source file line number with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
lineNumberFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the source file line number with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
lineSeparatorFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the platform line separator.

public static FormatStep

Returns:

the format step
lineSeparatorFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the platform line separator.

public static FormatStep

Returns:

the format step
localizedLevelFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the localized log level name.

public static FormatStep

Returns:

the format step
localizedLevelFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the localized log level name.

public static FormatStep

Returns:

the format step
locationInformationFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the complete source location information with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
locationInformationFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the complete source location information with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format
loggerNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final String
the argument used for the logger name, may be null or contain dots to format the logger name
precision
)

Create a format step which emits the logger name with the given justification rules.

public static FormatStep

Returns:

the format
loggerNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final String
the argument used for the logger name, may be null or contain dots to format the logger name
precision
)

Create a format step which emits the logger name with the given justification rules.

public static FormatStep

Returns:

the format step
mdcFormatStep
(final String key, final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the MDC value associated with the given key of the log record.

public static FormatStep

Returns:

the format step
mdcFormatStep
(final String key, final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the MDC value associated with the given key of the log record.

public static FormatStep

Returns:

the format step
messageFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the formatted log message text with the given justification rules.

public static FormatStep

Returns:

the format step
messageFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the formatted log message text with the given justification rules.

public static FormatStep

Returns:

the format step
methodNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the source method name with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
methodNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the source method name with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
moduleNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final String
the argument used for the class name, may be null or contain dots to format the class name
precision
)

Create a format step which emits the source module name with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
moduleNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final String
the argument used for the class name, may be null or contain dots to format the class name
precision
)

Create a format step which emits the source module name with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
moduleVersionFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final String
the argument used for the class name, may be null or contain dots to format the class name
precision
)

Create a format step which emits the source module version with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
ndcFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the NDC value of the log record.

public static FormatStep

Returns:

the format step
ndcFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
,
final int
the limit to the number of segments to format
count
)

Create a format step which emits the NDC value of the log record.

public static Formatter

Returns:

the null formatter
nullFormatter
()

Get the null formatter, which outputs nothing.

pack-priv static Deque<String>
parseCategorySegments(final String category)

pack-priv static Map<Integer, Formatters.Segment>
public static FormatStep

Returns:

the format step
processIdFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the source file line number with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

public static FormatStep

Returns:

the format step
processNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the source process name with the given justification rules.

public static FormatStep

Returns:

the format step
relativeTimeFormatStep
(final long
the base time as milliseconds as per System#currentTimeMillis()
baseTime
,
final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the number of milliseconds since the given base time.

public static FormatStep

Returns:

the format step
relativeTimeFormatStep
(final long
the base time as milliseconds as per System#currentTimeMillis()
baseTime
,
final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the number of milliseconds since the given base time.

public static FormatStep

Returns:

the format step
resourceKeyFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the log message resource key (if any) with the given justification rules.

public static FormatStep

Returns:

the format step
resourceKeyFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the log message resource key (if any) with the given justification rules.

public static FormatStep

Returns:

the format step
simpleMessageFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the formatted log message text (simple version, no exception traces) with the given justification rules.

public static FormatStep

Returns:

the format step
simpleMessageFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the formatted log message text (simple version, no exception traces) with the given justification rules.

public static FormatStep

Returns:

the format step
simpleMessageFormatStep
(final ExtFormatter formatter, final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the formatted log message text (simple version, no exception traces) with the given justification rules.

public static FormatStep

Returns:

the format step
simpleMessageFormatStep
(final ExtFormatter formatter, final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the formatted log message text (simple version, no exception traces) with the given justification rules.

public static FormatStep

Returns:

the format step
systemPropertyFormatStep
(final String
the argument that may be a key or key with a default value separated by a colon, cannot be null
argument
,
final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits a system property value associated with the given key.

public static FormatStep

Returns:

a format step
textFormatStep
(final String
the string to emit
string
)

Create a format step which simply emits the given string.

public static FormatStep

Returns:

the format step
threadFormatStep
(final String
the argument which may be id to indicate the thread id or null to indicate the thread name
argument
,
final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the id if id is passed as the argument, otherwise the the thread name is used.

public static FormatStep

Returns:

the format step
threadIdFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the id of the thread which originated the log record.

public static FormatStep

Returns:

the format step
threadNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the name of the thread which originated the log record.

public static FormatStep

Returns:

the format step
threadNameFormatStep
(final boolean
true to left justify, false to right justify
leftJustify
,
final int
the minimum field width, or 0 for none
minimumWidth
,
final boolean
true to truncate the beginning, otherwise false to truncate the end
truncateBeginning
,
final int
the maximum field width (must be greater than minimumFieldWidth), or 0 for none
maximumWidth
)

Create a format step which emits the name of the thread which originated the log record.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait