|
|
|
@ -120,6 +120,7 @@ function messagePassThroughLayout (loggingEvent) {
|
|
|
|
|
* - %r time in toLocaleTimeString format
|
|
|
|
|
* - %p log level
|
|
|
|
|
* - %c log category
|
|
|
|
|
* - %h hostname
|
|
|
|
|
* - %m log data
|
|
|
|
|
* - %d date in various formats
|
|
|
|
|
* - %% %
|
|
|
|
@ -143,7 +144,7 @@ function messagePassThroughLayout (loggingEvent) {
|
|
|
|
|
*/
|
|
|
|
|
function patternLayout (pattern, tokens) {
|
|
|
|
|
var TTCC_CONVERSION_PATTERN = "%r %p %c - %m%n";
|
|
|
|
|
var regex = /%(-?[0-9]+)?(\.?[0-9]+)?([\[\]cdmnprx%])(\{([^\}]+)\})?|([^%]+)/;
|
|
|
|
|
var regex = /%(-?[0-9]+)?(\.?[0-9]+)?([\[\]cdhmnprx%])(\{([^\}]+)\})?|([^%]+)/;
|
|
|
|
|
|
|
|
|
|
pattern = pattern || TTCC_CONVERSION_PATTERN;
|
|
|
|
|
|
|
|
|
@ -166,6 +167,8 @@ function patternLayout (pattern, tokens) {
|
|
|
|
|
// Pick up special cases
|
|
|
|
|
if (format == "ISO8601") {
|
|
|
|
|
format = dateFormat.ISO8601_FORMAT;
|
|
|
|
|
} else if (format == "ISO8601_WITH_TZ_OFFSET") {
|
|
|
|
|
format = dateFormat.ISO8601_WITH_TZ_OFFSET_FORMAT;
|
|
|
|
|
} else if (format == "ABSOLUTE") {
|
|
|
|
|
format = dateFormat.ABSOLUTETIME_FORMAT;
|
|
|
|
|
} else if (format == "DATE") {
|
|
|
|
@ -175,6 +178,10 @@ function patternLayout (pattern, tokens) {
|
|
|
|
|
// Format the date
|
|
|
|
|
return dateFormat.asString(format, loggingEvent.startTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function hostname() {
|
|
|
|
|
return os.hostname().toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function formatMessage(loggingEvent) {
|
|
|
|
|
return formatLogData(loggingEvent.data);
|
|
|
|
@ -218,6 +225,7 @@ function patternLayout (pattern, tokens) {
|
|
|
|
|
var replacers = {
|
|
|
|
|
'c': categoryName,
|
|
|
|
|
'd': formatAsDate,
|
|
|
|
|
'h': hostname,
|
|
|
|
|
'm': formatMessage,
|
|
|
|
|
'n': endOfLine,
|
|
|
|
|
'p': logLevel,
|
|
|
|
|