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

Print full exception when console is non-interactive #88297

Merged

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Jul 5, 2022

The console logger truncates stack traces so a user is not bombarded
with enormouse messages on startup. However, when the output is
redirected to a file, there is no need to avoid large messages, and in
fact it is a hinderance to debugging. This commit adds an internal flag
to the console logging exception convert which disables the truncation
when attached to a non-interactive console.

The console logger truncates stack traces so a user is not bombarded
with enormouse messages on startup. However, when the output is
redirected to a file, there is no need to avoid large messages, and in
fact it is a hinderance to debugging. This commit adds an internal flag
to the console logging exception convert which disables the truncation
when attached to a non-interactive console.
@rjernst rjernst added >enhancement :Core/Infra/Core Core issues without another label v8.4.0 labels Jul 5, 2022
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jul 5, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @rjernst, I've created a changelog YAML for you.

Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

*/
@Plugin(name = "consoleException", category = PatternConverter.CATEGORY)
@ConverterKeys({ "consoleException" })
public class ConsoleThrowablePatternConverter extends ThrowablePatternConverter {
private ConsoleThrowablePatternConverter(String[] options, Configuration config) {

// true if exceptions shoudwhether exception formatting should always be delegated to the super class
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: text in comment.

@rjernst rjernst added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Jul 6, 2022
@elasticsearchmachine elasticsearchmachine merged commit 26c256c into elastic:master Jul 6, 2022
@rjernst rjernst deleted the startup/logging_no_console branch July 6, 2022 01:54
}

@Override
public void format(final LogEvent event, final StringBuilder toAppendTo) {
Throwable error = event.getThrown();
if (error == null) {
if (enabled == false | error == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjernst did you mean to use a bitwise OR here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not! I opened #88310

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Core/Infra/Core Core issues without another label >enhancement Team:Core/Infra Meta label for core/infra team v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants