-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Printing process warning's via the appropriate loggers #8746
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
Conversation
@@ -21,4 +21,4 @@ if [ ! -x "$NODE" ]; then | |||
exit 1 | |||
fi | |||
|
|||
exec "${NODE}" $NODE_OPTIONS "${DIR}/src/cli" ${@} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't been able to find a way to selectively add this flag, besides potentially determining if the --dev flag is provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding the flag all the time is fine, since we are forwarding all the messages via the server logger.
@@ -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" ${@} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The kibana-plugin is currently not displaying the warnings at all, currently investigating the best way to determine if "we're in production"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cli plugin command has it's own logger with it's own opinions about when messages should and shouldn't be logged (controlled with --silent
and --quiet
) https://github.com/elastic/kibana/blob/master/src/cli_plugin/lib/logger.js
We should probably wire this up in that cli
@@ -0,0 +1,9 @@ | |||
export default function (kbnServer, server, config) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming that we only have one instance of the kbnServer per 'process' (including when we're clustering) so we won't be subscribing to this event twice and possibly getting duplicate warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming that we only have one instance of the kbnServer per 'process' (including when we're clustering) so we won't be subscribing to this event twice and possibly getting duplicate warnings.
Not necessarily, but I don't think there is a better option right now.
@spalger @tylersmalley should we consider switching the approach to the one that tyler has here: 0865c55 The main benefit that I see from Tyler's approach, is that warnings that are emitted before we hit the place where I'm registering the |
@@ -0,0 +1,9 @@ | |||
export default function (kbnServer, server, config) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming that we only have one instance of the kbnServer per 'process' (including when we're clustering) so we won't be subscribing to this event twice and possibly getting duplicate warnings.
Not necessarily, but I don't think there is a better option right now.
} | ||
|
||
process.on('warning', (warning) => { | ||
server.log(['warning'], warning); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a 'process'
tag so that these warnings can be identified specifically
@@ -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" ${@} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cli plugin command has it's own logger with it's own opinions about when messages should and shouldn't be logged (controlled with --silent
and --quiet
) https://github.com/elastic/kibana/blob/master/src/cli_plugin/lib/logger.js
We should probably wire this up in that cli
@@ -21,4 +21,4 @@ if [ ! -x "$NODE" ]; then | |||
exit 1 | |||
fi | |||
|
|||
exec "${NODE}" $NODE_OPTIONS "${DIR}/src/cli" ${@} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding the flag all the time is fine, since we are forwarding all the messages via the server logger.
6f4aaac
to
96ef75b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--------- **Commit 1:** Printing process warning's via the appropriate logger * Original sha: 96ef75b * Authored by = <[email protected]> on 2016-10-19T10:41:45Z
--------- **Commit 1:** Printing process warning's via the appropriate logger * Original sha: 96ef75b * Authored by = <[email protected]> on 2016-10-19T10:41:45Z
Does this need to be backported to 4.7? |
@jbudz if we're upgrading Node to 6.x, yup. |
Node 6.6+ writes warnings to stderr rather than stdout, but we want those warnings to piped through as warnings in our Kibana logger instead.
--------- **Commit 1:** Printing process warning's via the appropriate logger * Original sha: f464a80786985c596a8f1155164a044c5f0fa39f [formerly 96ef75b] * Authored by = <[email protected]> on 2016-10-19T10:41:45Z Former-commit-id: 32cbd7c
[backport] PR elastic#8746 to 5.x Former-commit-id: 1171461
Node v6.6.0 by default writes warnings to STDERR per https://nodejs.org/dist/latest-v6.x/docs/api/process.html#process_event_warning
This modification would by default suppress these warnings from being written to STDERR by using the --no-warnings flag, and then we'd selectively write these errors using the proper logging method.
Addresses: #8746