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