JBoss LogManager 1.1.0.CR6

org.jboss.logmanager.formatters
Class Formatters

java.lang.Object
  extended by org.jboss.logmanager.formatters.Formatters

public final class Formatters
extends Object

Formatter utility methods.


Method Summary
static FormatStep classNameFormatStep(boolean leftJustify, int minimumWidth, int maximumWidth, int count)
          Create a format step which emits the source class name with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).
static FormatStep dateFormatStep(String formatString, boolean leftJustify, int minimumWidth, int maximumWidth)
          Create a format step which emits the date of the log record with the given justificaiton rules.
static FormatStep fileNameFormatStep(boolean leftJustify, int minimumWidth, int 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).
static FormatStep levelFormatStep(boolean leftJustify, int minimumWidth, int maximumWidth)
          Create a format step which emits the localized log level name.
static FormatStep lineNumberFormatStep(boolean leftJustify, int minimumWidth, int 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).
static FormatStep lineSeparatorFormatStep(boolean leftJustify, int minimumWidth, int maximumWidth)
          Create a format step which emits the platform line separator.
static FormatStep locationInformationFormatStep(boolean leftJustify, int minimumWidth, int 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).
static FormatStep loggerNameFormatStep(boolean leftJustify, int minimumWidth, int maximumWidth, int count)
          Create a format step which emits the logger name with the given justification rules.
static FormatStep mdcFormatStep(String key, boolean leftJustify, int minimumWidth, int maximumWidth)
          Create a format step which emits the MDC value associated with the given key of the log record.
static FormatStep messageFormatStep(boolean leftJustify, int minimumWidth, int maximumWidth)
          Create a format step which emits the formatted log message text with the given justification rules.
static FormatStep methodNameFormatStep(boolean leftJustify, int minimumWidth, int 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).
static FormatStep ndcFormatStep(boolean leftJustify, int minimumWidth, int maximumWidth)
          Create a format step which emits the NDC value of the log record.
static Formatter nullFormatter()
          Get the null formatter, which outputs nothing.
static FormatStep relativeTimeFormatStep(long baseTime, boolean leftJustify, int minimumWidth, int maximumWidth)
          Create a format step which emits the number of milliseconds since the given base time.
static FormatStep textFormatStep(String string)
          Create a format step which simply emits the given string.
static FormatStep threadNameFormatStep(boolean leftJustify, int minimumWidth, int maximumWidth)
          Create a format step which emits the name of the thread which originated the log record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

nullFormatter

public static Formatter nullFormatter()
Get the null formatter, which outputs nothing.

Returns:
the null formatter

textFormatStep

public static FormatStep textFormatStep(String string)
Create a format step which simply emits the given string.

Parameters:
string - the string to emit
Returns:
a format step

loggerNameFormatStep

public static FormatStep loggerNameFormatStep(boolean leftJustify,
                                              int minimumWidth,
                                              int maximumWidth,
                                              int count)
Create a format step which emits the logger name with the given justification rules.

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
count - the maximum number of logger name segments to emit (counting from the right)
Returns:
the format step

classNameFormatStep

public static FormatStep classNameFormatStep(boolean leftJustify,
                                             int minimumWidth,
                                             int maximumWidth,
                                             int count)
Create a format step which emits the source class name with the given justification rules (NOTE: call stack introspection introduces a significant performance penalty).

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
count - the maximum number of class name segments to emit (counting from the right)
Returns:
the format step

dateFormatStep

public static FormatStep dateFormatStep(String formatString,
                                        boolean leftJustify,
                                        int minimumWidth,
                                        int maximumWidth)
Create a format step which emits the date of the log record with the given justificaiton rules.

Parameters:
formatString - the date format string
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

fileNameFormatStep

public static FormatStep fileNameFormatStep(boolean leftJustify,
                                            int minimumWidth,
                                            int 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).

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

locationInformationFormatStep

public static FormatStep locationInformationFormatStep(boolean leftJustify,
                                                       int minimumWidth,
                                                       int 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).

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

lineNumberFormatStep

public static FormatStep lineNumberFormatStep(boolean leftJustify,
                                              int minimumWidth,
                                              int 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).

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

messageFormatStep

public static FormatStep messageFormatStep(boolean leftJustify,
                                           int minimumWidth,
                                           int maximumWidth)
Create a format step which emits the formatted log message text with the given justification rules.

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

methodNameFormatStep

public static FormatStep methodNameFormatStep(boolean leftJustify,
                                              int minimumWidth,
                                              int 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).

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

lineSeparatorFormatStep

public static FormatStep lineSeparatorFormatStep(boolean leftJustify,
                                                 int minimumWidth,
                                                 int maximumWidth)
Create a format step which emits the platform line separator.

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

levelFormatStep

public static FormatStep levelFormatStep(boolean leftJustify,
                                         int minimumWidth,
                                         int maximumWidth)
Create a format step which emits the localized log level name.

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

relativeTimeFormatStep

public static FormatStep relativeTimeFormatStep(long baseTime,
                                                boolean leftJustify,
                                                int minimumWidth,
                                                int maximumWidth)
Create a format step which emits the number of milliseconds since the given base time.

Parameters:
baseTime - the base time as milliseconds as per System.currentTimeMillis()
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

threadNameFormatStep

public static FormatStep threadNameFormatStep(boolean leftJustify,
                                              int minimumWidth,
                                              int maximumWidth)
Create a format step which emits the name of the thread which originated the log record.

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

ndcFormatStep

public static FormatStep ndcFormatStep(boolean leftJustify,
                                       int minimumWidth,
                                       int maximumWidth)
Create a format step which emits the NDC value of the log record.

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

mdcFormatStep

public static FormatStep mdcFormatStep(String key,
                                       boolean leftJustify,
                                       int minimumWidth,
                                       int maximumWidth)
Create a format step which emits the MDC value associated with the given key of the log record.

Parameters:
leftJustify - true to left justify, false to right justify
minimumWidth - the minimum field width, or 0 for none
maximumWidth - the maximum field width (must be greater than minimumFieldWidth), or 0 for none
Returns:
the format step

JBoss LogManager 1.1.0.CR6

Copyright © 2009 JBoss, a division of Red Hat, Inc.