log4js-node/examples/patternLayout-tokens.js

21 lines
431 B
JavaScript
Raw Permalink Normal View History

var log4js = require('./lib/log4js');
2013-02-08 23:18:27 +08:00
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");