diff --git a/lib/layouts.js b/lib/layouts.js index 270f336..94f273d 100644 --- a/lib/layouts.js +++ b/lib/layouts.js @@ -295,9 +295,7 @@ function patternLayout (pattern, tokens) { } else { // Create a raw replacement string based on the conversion // character and specifier - var replacement = - replaceToken(conversionCharacter, loggingEvent, specifier) || - matchedString; + var replacement = replaceToken(conversionCharacter, loggingEvent, specifier); // Format the replacement according to any padding or // truncation specified diff --git a/test/layouts-test.js b/test/layouts-test.js index db6ba56..01c777e 100644 --- a/test/layouts-test.js +++ b/test/layouts-test.js @@ -282,14 +282,14 @@ vows.describe('log4js layouts').addBatch({ test(args, '%x{testFunction}', 'testFunctionToken'); }, '%x{doesNotExist} should output the string stored in tokens': function(args) { - test(args, '%x{doesNotExist}', '%x{doesNotExist}'); + test(args, '%x{doesNotExist}', 'null'); }, '%x{fnThatUsesLogEvent} should be able to use the logEvent': function(args) { test(args, '%x{fnThatUsesLogEvent}', 'DEBUG'); }, '%x should output the string stored in tokens': function(args) { - test(args, '%x', '%x'); - }, + test(args, '%x', 'null'); + } }, 'layout makers': { topic: require('../lib/layouts'),