added example on pattern tokens usage
This commit is contained in:
parent
5c75ba9468
commit
af428c5669
21
examples/patternLayout-tokens.js
Normal file
21
examples/patternLayout-tokens.js
Normal file
@ -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");
|
Loading…
Reference in New Issue
Block a user