Class OneLineFormatter
java.lang.Object
java.util.logging.Formatter
org.apache.juli.OneLineFormatter
- Direct Known Subclasses:
JsonFormatter
Provides same information as default log format but on a single line to make it easier to grep the logs. The only
exception is stacktraces which are always preceded by whitespace to make it simple to skip them.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addTimestamp
(StringBuilder buf, long timestamp) protected static String
getThreadName
(long logRecordThreadId) LogRecord has threadID but no thread name.Obtain the format currently being used for time stamps in log messages.void
setTimeFormat
(String timeFormat) Specify the time format to use for time stamps in log messages.Methods inherited from class java.util.logging.Formatter
formatMessage, getHead, getTail
-
Constructor Details
-
OneLineFormatter
public OneLineFormatter()
-
-
Method Details
-
setTimeFormat
Specify the time format to use for time stamps in log messages.- Parameters:
timeFormat
- The format to use using theSimpleDateFormat
syntax
-
getTimeFormat
Obtain the format currently being used for time stamps in log messages.- Returns:
- The current format in
SimpleDateFormat
syntax
-
format
-
addTimestamp
-
getThreadName
LogRecord has threadID but no thread name.- Parameters:
logRecordThreadId
- the thread id- Returns:
- the thread name
-