java.lang.Object
org.glassfish.main.jul.formatter.LogFormatDetector
Detector of known standardized log formats.
- Author:
- David Matejcek
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringPatternstring for usual message key used with resource bundles: if present, letters, dots and numbers.static final StringPatternstring for a product id: any non-mandatory text.static final StringPatternstring for usual time format: HH:mm:ss.SSSstatic final StringPatternstring for usual ISO-8601 timestamp format: 2021-05-20T12:45:33.123456Zstatic final StringPatternstring for usual time zone format: +02:00, +0200 or Z -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetectFormatter(File logFile, Charset expectedCharset) detectFormatter(String firstLine) booleanisCompressedFile(String filename) Determines whether the given file is compressed (name ends with .gz).booleanisODLFormatLogHeader(String firstLine) booleanisOneLineLFormatLogHeader(String firstLine) booleanisUniformFormatLogHeader(String firstLine)
-
Field Details
-
P_TIME
Patternstring for usual time format: HH:mm:ss.SSS- See Also:
-
P_TIMEZONE
Patternstring for usual time zone format: +02:00, +0200 or Z- See Also:
-
P_TIMESTAMP
Patternstring for usual ISO-8601 timestamp format: 2021-05-20T12:45:33.123456Z- See Also:
-
P_LEVEL_NAME
- See Also:
-
P_LEVEL_VALUE
- See Also:
-
P_LOGGER_NAME
- See Also:
-
P_MESSAGE_KEY
Patternstring for usual message key used with resource bundles: if present, letters, dots and numbers.- See Also:
-
P_PRODUCT_ID
Patternstring for a product id: any non-mandatory text.- See Also:
-
-
Constructor Details
-
LogFormatDetector
public LogFormatDetector()
-
-
Method Details
-
detectFormatter
- Parameters:
logFile-expectedCharset-- Returns:
- full class name of the concrete detected
Formatteror null if the file is null or could not be read.
-
detectFormatter
- Parameters:
firstLine-- Returns:
- null for unknown file format, full class name otherwise.
-
isODLFormatLogHeader
- Parameters:
firstLine-- Returns:
- true if the given line is probably a beginning of a ODL log record.
-
isOneLineLFormatLogHeader
- Parameters:
firstLine-- Returns:
- true if the given line is probably a beginning of a
OneLineFormatter's log record.
-
isUniformFormatLogHeader
- Parameters:
firstLine-- Returns:
- true if the given line is probably a beginning of a Uniform log record.
-
isCompressedFile
Determines whether the given file is compressed (name ends with .gz).- Parameters:
filename-- Returns:
- true if the filename ends with ".gz"
-