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

Replace System.err & System.out with proper logger API #15

Open
KengoTODA opened this issue Sep 8, 2017 · 3 comments
Open

Replace System.err & System.out with proper logger API #15

KengoTODA opened this issue Sep 8, 2017 · 3 comments

Comments

@KengoTODA
Copy link
Contributor

Current implementation uses System.out and System.err to output debug information, but it should be avoided in production code. Because using stdout and/or stderr directly makes system maintenance difficult, it doesn't support filtering base on log level nor class. It is also hard to apply log rotation and other log management mechanism.

I cannot judge which logger API we should use, probably it is one of followings:

  1. SLF4J API, which is common in Java ecosystem
  2. JUL (java.util.logging) API, which is standard in Java but little bit hard to maintain
  3. Log4J 2 which is used by Elasticsearch core
@KengoTODA
Copy link
Contributor Author

KengoTODA commented Sep 27, 2017

It is OK to use System.err and System.out in main class such as SudachiCommandLine.java and PrintDictionaryHeader.java. But at least DictionaryBuilder.java should use logger interface.

It seems that SLF4J is not so active recently, then I recommend to use Log4J 2.

@kazuma-t
Copy link
Member

I expect to use DictionaryBuilder.java and UserDictionaryBuilder.java on the command line. Should I use a logger for them?

@KengoTODA
Copy link
Contributor Author

Then not high priority I think.

If I was you, I will introduce logger system eventually. It makes product easy to introduce --debug, --verbose or other flags with keeping performance and readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants