Skip to content

Commit

Permalink
chore(merge): merging from master
Browse files Browse the repository at this point in the history
  • Loading branch information
Gareth Jones committed Nov 17, 2017
2 parents 906a774 + 7e008b9 commit f1a7d57
Show file tree
Hide file tree
Showing 10 changed files with 1,772 additions and 5,926 deletions.
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ lib-cov
coverage.html
Makefile
coverage
Gemfile
Gemfile.lock
9 changes: 5 additions & 4 deletions lib/log4js.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ function setLevelForCategory(category, level) {
debug(`setLevelForCategory: found ${categoryConfig} for ${category}`);
if (!categoryConfig) {
const sourceCategoryConfig = configForCategory(category);
debug('setLevelForCategory: no config found for category, found ' +
`${sourceCategoryConfig} for parents of ${category}`);
debug('setLevelForCategory: no config found for category, ' +
`found ${sourceCategoryConfig} for parents of ${category}`);
categoryConfig = { appenders: sourceCategoryConfig.appenders };
}
categoryConfig.level = level;
Expand Down Expand Up @@ -204,18 +204,19 @@ function configure(configurationFileOrObject) {
LoggingEvent = loggerModule.LoggingEvent;
module.exports.connectLogger = connectModule(config.levels).connectLogger;

// just in case configure is called after shutdown
process.removeListener('message', receiver);
cluster.removeListener('message', receiver);
if (config.disableClustering) {
debug('Not listening for cluster messages, because clustering disabled.');
} else if (isPM2Master()) {
// PM2 cluster support
// PM2 runs everything as workers - install pm2-intercom for this to work.
// we only want one of the app instances to write logs
debug('listening for PM2 broadcast messages');
process.removeListener('message', receiver);
process.on('message', receiver);
} else if (cluster.isMaster) {
debug('listening for cluster messages');
cluster.removeListener('message', receiver);
cluster.on('message', receiver);
} else {
debug('not listening for messages, because we are not a master process');
Expand Down

0 comments on commit f1a7d57

Please sign in to comment.