Skip to content
New issue

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

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

Already on GitHub? # to your account

Changes default logging to write to System.out. #1145

Merged
merged 2 commits into from
Nov 18, 2019

Conversation

batsatt
Copy link
Contributor

@batsatt batsatt commented Nov 14, 2019

Fixes #1144.

Note that by setting the level in the handler to Level.ALL, the only levels that matter are those on the loggers, which is what nearly everyone expects.

@batsatt batsatt self-assigned this Nov 14, 2019
/**
* Logging handler that writes to {@link System#out} and uses a formatter that will replace {@code "!thread!"} substrings
* with the current thread.
*/
Copy link
Member

@ljnelson ljnelson Nov 15, 2019

Choose a reason for hiding this comment

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

How about: "A {@link StreamHandler} that writes to {@linkplain System#out standard out} and uses a {@link ThreadFormatter} for formatting purposes."

And: "@see ThreadFormatter". Assuming it becomes public of course.

public class HelidonConsoleHandler extends StreamHandler {

/**
* Constructor.
Copy link
Member

@ljnelson ljnelson Nov 15, 2019

Choose a reason for hiding this comment

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

How about: "Creates a new {@link HelidonConsoleHandler}."

setFormatter(new ThreadFormatter());
}

@Override
Copy link
Member

Choose a reason for hiding this comment

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

Probably worth documenting what you do in this method.

flush();
}

@Override
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

flush();
}

private static class ThreadFormatter extends SimpleFormatter {
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a useful class in general; perhaps make it public?

@batsatt batsatt requested review from ljnelson and tomas-langer and removed request for tomas-langer November 18, 2019 22:56
@batsatt batsatt merged commit c082748 into helidon-io:master Nov 18, 2019
@batsatt batsatt deleted the log-to-stdout branch November 18, 2019 23:27
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Default logging should write to stdout, not stderr
2 participants