diff --git a/bin/kibana b/bin/kibana index 1606ad2813025..93854e3f8e5fb 100755 --- a/bin/kibana +++ b/bin/kibana @@ -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" ${@} diff --git a/bin/kibana-plugin b/bin/kibana-plugin index 7e8481fa71a2e..4d36bee476bd3 100755 --- a/bin/kibana-plugin +++ b/bin/kibana-plugin @@ -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" ${@} diff --git a/bin/kibana-plugin.bat b/bin/kibana-plugin.bat index 9d8bdc4778129..3a1554f6f780f 100644 --- a/bin/kibana-plugin.bat +++ b/bin/kibana-plugin.bat @@ -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 diff --git a/bin/kibana.bat b/bin/kibana.bat index 2c39d080bf0ad..d126bb9d1c92b 100644 --- a/bin/kibana.bat +++ b/bin/kibana.bat @@ -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 diff --git a/src/cli_plugin/install/index.js b/src/cli_plugin/install/index.js index 78547d1db006b..c42b3ad687884 100644 --- a/src/cli_plugin/install/index.js +++ b/src/cli_plugin/install/index.js @@ -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; @@ -18,6 +19,7 @@ function processCommand(command, options) { } const logger = new Logger(settings); + logWarnings(settings, logger); install(settings, logger); } diff --git a/src/cli_plugin/lib/log_warnings.js b/src/cli_plugin/lib/log_warnings.js new file mode 100644 index 0000000000000..35d3bd51bc4bb --- /dev/null +++ b/src/cli_plugin/lib/log_warnings.js @@ -0,0 +1,5 @@ +export default function (settings, logger) { + process.on('warning', (warning) => { + logger.error(warning); + }); +} diff --git a/src/cli_plugin/list/index.js b/src/cli_plugin/list/index.js index 102eec3f1825c..1efe265902472 100644 --- a/src/cli_plugin/list/index.js +++ b/src/cli_plugin/list/index.js @@ -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; @@ -14,6 +15,7 @@ function processCommand(command, options) { } const logger = new Logger(settings); + logWarnings(settings, logger); list(settings, logger); } diff --git a/src/cli_plugin/remove/index.js b/src/cli_plugin/remove/index.js index 9cc99fc534004..425112a35045e 100644 --- a/src/cli_plugin/remove/index.js +++ b/src/cli_plugin/remove/index.js @@ -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; @@ -15,6 +16,7 @@ function processCommand(command, options) { } const logger = new Logger(settings); + logWarnings(settings, logger); remove(settings, logger); } diff --git a/src/server/kbn_server.js b/src/server/kbn_server.js index fa25f70387665..dd4088c0b4421 100644 --- a/src/server/kbn_server.js +++ b/src/server/kbn_server.js @@ -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 diff --git a/src/server/warnings/index.js b/src/server/warnings/index.js new file mode 100644 index 0000000000000..99fcadb6eeb5e --- /dev/null +++ b/src/server/warnings/index.js @@ -0,0 +1,5 @@ +export default function (kbnServer, server, config) { + process.on('warning', (warning) => { + server.log(['warning', 'process'], warning); + }); +}