A [hook.io](https://github.com/hookio) logger has been added to logjs by [dbrain](https://github.com/dbrain). This allows multiple worker processes to log through a single master process, avoiding issues with rolling etc. in a clustered environment.
This was mainly created for [cluster](https://github.com/LearnBoost/cluster), but you can adapt the example to match your needs, you know, if it fits them.
<pre>
#### log4js-master.json ####
{
"appenders": [{
"type": "logLevelFilter",
"level": "DEBUG",
"appender": {
"type": "hookio",
"name": "hookio-logger",
"mode": "master",
"debug": false,
"appender": {
"type": "file",
"filename": "muffin.log",
"maxLogSize": 104857600,
"backups": 10,
"pollInterval": 15
}
}
}]
}
#### log4js-worker.json ####
{
"appenders": [{
"type": "logLevelFilter",
"level": "DEBUG",
"appender": {
"type": "hookio",
"name": "hookio-logger",
"mode": "worker",
"debug": false
}
}]
}
#### ilikebeans.js ####
var cluster = require('cluster');
var hookCluster = cluster('./doyoulikebeans');
// Perform the once off configuration depending on type of cluster