Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport] PR #8746 to 5.x - Printing process warning's via the appropriate loggers #8757

Merged
merged 1 commit into from
Oct 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/kibana
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ if [ ! -x "$NODE" ]; then
exit 1
fi

exec "${NODE}" $NODE_OPTIONS "${DIR}/src/cli" ${@}
exec "${NODE}" $NODE_OPTIONS --no-warnings "${DIR}/src/cli" ${@}
2 changes: 1 addition & 1 deletion bin/kibana-plugin
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ if [ ! -x "$NODE" ]; then
exit 1
fi

exec "${NODE}" $NODE_OPTIONS "${DIR}/src/cli_plugin" ${@}
exec "${NODE}" $NODE_OPTIONS --no-warnings "${DIR}/src/cli_plugin" ${@}
2 changes: 1 addition & 1 deletion bin/kibana-plugin.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If Not Exist "%NODE%" (
)

TITLE Kibana Server
"%NODE%" %NODE_OPTIONS% "%DIR%\src\cli_plugin" %*
"%NODE%" %NODE_OPTIONS% --no-warnings "%DIR%\src\cli_plugin" %*

:finally

Expand Down
2 changes: 1 addition & 1 deletion bin/kibana.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If Not Exist "%NODE%" (
)

TITLE Kibana Server
"%NODE%" %NODE_OPTIONS% "%DIR%\src\cli" %*
"%NODE%" %NODE_OPTIONS% --no-warnings "%DIR%\src\cli" %*

:finally

Expand Down
2 changes: 2 additions & 0 deletions src/cli_plugin/install/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import pkg from '../../utils/package_json';
import { getConfig } from '../../server/path';
import { parse, parseMilliseconds } from './settings';
import { find } from 'lodash';
import logWarnings from '../lib/log_warnings';

function processCommand(command, options) {
let settings;
Expand All @@ -18,6 +19,7 @@ function processCommand(command, options) {
}

const logger = new Logger(settings);
logWarnings(settings, logger);
install(settings, logger);
}

Expand Down
5 changes: 5 additions & 0 deletions src/cli_plugin/lib/log_warnings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function (settings, logger) {
process.on('warning', (warning) => {
logger.error(warning);
});
}
2 changes: 2 additions & 0 deletions src/cli_plugin/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { fromRoot } from '../../utils';
import list from './list';
import Logger from '../lib/logger';
import { parse } from './settings';
import logWarnings from '../lib/log_warnings';

function processCommand(command, options) {
let settings;
Expand All @@ -14,6 +15,7 @@ function processCommand(command, options) {
}

const logger = new Logger(settings);
logWarnings(settings, logger);
list(settings, logger);
}

Expand Down
2 changes: 2 additions & 0 deletions src/cli_plugin/remove/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import remove from './remove';
import Logger from '../lib/logger';
import { parse } from './settings';
import { getConfig } from '../../server/path';
import logWarnings from '../lib/log_warnings';

function processCommand(command, options) {
let settings;
Expand All @@ -15,6 +16,7 @@ function processCommand(command, options) {
}

const logger = new Logger(settings);
logWarnings(settings, logger);
remove(settings, logger);
}

Expand Down
1 change: 1 addition & 0 deletions src/server/kbn_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = class KbnServer {
require('./config/setup'), // sets this.config, reads this.settings
require('./http'), // sets this.server
require('./logging'),
require('./warnings'),
require('./status'),

// writes pid file
Expand Down
5 changes: 5 additions & 0 deletions src/server/warnings/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function (kbnServer, server, config) {
process.on('warning', (warning) => {
server.log(['warning', 'process'], warning);
});
}