From af428c5669470b00f95df04da28a000536d591b3 Mon Sep 17 00:00:00 2001 From: Jan Schmidle Date: Fri, 8 Feb 2013 16:18:27 +0100 Subject: [PATCH] added example on pattern tokens usage --- examples/patternLayout-tokens.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/patternLayout-tokens.js diff --git a/examples/patternLayout-tokens.js b/examples/patternLayout-tokens.js new file mode 100644 index 0000000..18cd6f7 --- /dev/null +++ b/examples/patternLayout-tokens.js @@ -0,0 +1,21 @@ +var log4js = require("log4js"); + +var config = { + "appenders": [ + { + "type": "console", + "layout": { + "type": "pattern", + "pattern": "%[%r (%x{pid}) %p %c -%] %m%n", + "tokens": { + "pid" : function() { return process.pid; } + } + } + } + ] + }; + +log4js.configure(config, {}); + +var logger = log4js.getLogger("app"); +logger.info("Test log message"); \ No newline at end of file