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

Code style/Ops: use Logger.log instead of System.out.print[ln] #2575

Closed
bencomp opened this issue Sep 23, 2015 · 2 comments
Closed

Code style/Ops: use Logger.log instead of System.out.print[ln] #2575

bencomp opened this issue Sep 23, 2015 · 2 comments

Comments

@bencomp
Copy link
Contributor

bencomp commented Sep 23, 2015

Following up on #775.

java.util.logging.Logger provides a consistent way of sending log messages to the centralised log, including a level indicating the importance of the message. System.out.print and System.out.println messages do end up in the log, but without a source and all at Level.INFO.

It helps tremendously to operate a Dataverse installation if log messages are informative. That, to us, means that every message has at least a source and the right importance level. Currently there are nearly 200 uses of System.out in the codebase, although a lot are commented out and some are even "hidden" inside something like:

private void msg(String s){
    System.out.println(s);
}

The style guide has more tips for logging, like using the warning (or severe) level when an exception is caught.

bencomp added a commit to bencomp/dataverse that referenced this issue Sep 24, 2015
@mercecrosas mercecrosas modified the milestone: In Review Nov 30, 2015
@mheppler mheppler added Component: Documentation Component: Code Infrastructure formerly "Feature: Code Infrastructure" labels Jan 28, 2016
@scolapasta scolapasta removed this from the Not Assigned to a Release milestone Jan 28, 2016
@pdurbin pdurbin self-assigned this Jun 9, 2017
@pdurbin pdurbin removed Component: Code Infrastructure formerly "Feature: Code Infrastructure" Status: Triaged labels Jun 13, 2017
@pdurbin
Copy link
Member

pdurbin commented Jun 20, 2017

I implemented this in 6535d9d and am closing this issue in favor of #3418.

@bencomp
Copy link
Contributor Author

bencomp commented Jun 21, 2017

Nice work on the style guide, @pdurbin!

Note that println is still used – and not only in tests or command-line interfaces.

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

5 participants