log4js-node/examples/patternLayout-tokens.js

21 lines
425 B
JavaScript
Raw Normal View History

2013-02-08 23:18:27 +08:00
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");