Skip to content

Commit

Permalink
Merge pull request #31 from nodejitsu/consistent-logs
Browse files Browse the repository at this point in the history
[minor] More consistent logging in `restart` and `stop`.
  • Loading branch information
jcrugzz committed Sep 3, 2013
2 parents be1ec2c + 127500e commit c3c6b56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 1 addition & 4 deletions bin/solenoid
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,9 @@ if (action === 'start') {
version: argv['app-version'],
env: argv['app-env']
};
logger.info('Starting application...');
}
else {
logger.info('Stopping application...');
}

logger.info('Running ' + action + ' for app.');
solenoid[action](options, function (err) {
if (err) {
logger.error('Error: ' + err.message);
Expand Down
7 changes: 6 additions & 1 deletion lib/solenoid.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ exports.start = function (options, callback) {
};

exports.restart = function (options, callback) {
var logger = options.logger;

fs.exists(options.pidFile, function (exists) {
if (!exists) {
return callback(new Error(options.pidFile + ' does not exist.'));
Expand All @@ -46,9 +48,10 @@ exports.restart = function (options, callback) {
}

content = parseInt(content, 10);
logger.info('Sending SIGUSR1 - ' + content);
if (!Number.isNaN(content)) {
try { process.kill(content, 'SIGUSR1') }
catch (ex) { }
catch (ex) { logger.info('SIGUSR1 Error - ' + ex.message) }
}

callback();
Expand All @@ -71,6 +74,7 @@ exports.stop = function (options, callback) {
return clean(options, callback);
}

logger.info('Sending terminate signal - ' + content);
killer({
pid: content,
timeout: 10000,
Expand Down Expand Up @@ -98,6 +102,7 @@ var clean = exports.clean = function clean(options, callback) {

var logger = options.logger;

logger.info('Cleaning ' + options.runDir);
async.forEachSeries(commands, function (args, next) {
var command = args.shift(),
child = spawn(command, args);
Expand Down

0 comments on commit c3c6b56

Please sign in to comment.