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

4792: Stop using System.out/err.println and e.printStackTrace #272

Closed
wants to merge 4 commits into from

Conversation

jpbempel
Copy link
Member

@jpbempel jpbempel commented Jul 5, 2021

replaced by java.util.logging logging


Progress

  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JMC-4792: Stop using System.out/err.println and e.printStackTrace

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jmc pull/272/head:pull/272
$ git checkout pull/272

Update a local copy of the PR:
$ git checkout pull/272
$ git pull https://git.openjdk.java.net/jmc pull/272/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 272

View PR using the GUI difftool:
$ git pr show -t 272

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jmc/pull/272.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 5, 2021

👋 Welcome back jpbempel! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Jul 5, 2021
@mlbridge
Copy link

mlbridge bot commented Jul 5, 2021

Webrevs

@@ -78,7 +78,7 @@ private static Method getRegisterMethod(Class<?> producerClass) {
// This should never happen
Agent.getLogger().severe("Failed to find the addEvent method of the producer.");
Copy link
Member

Choose a reason for hiding this comment

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

Let's just roll them up into one logger call with stacktrace.

@@ -110,10 +110,10 @@ public boolean accept(File dir, String name) {
repository.add(template);
} catch (IOException e) {
// FIXME: Better exception handling
e.printStackTrace();
ControlPanel.getDefault().getLogger().log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

"Failed to load local template from file"?

} catch (ParseException e) {
// FIXME: Better exception handling
e.printStackTrace();
ControlPanel.getDefault().getLogger().log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

"Failed to parse local template from file " + file...

@@ -237,13 +237,13 @@ private EventConfigurationRepository createRepository(IFlightRecorderService flr
repo.add(new EventConfiguration(EventConfiguration.createModel(templateXML),
VolatileStorageDelegate.getOnServerDelegate()));
} catch (ParseException e) {
e.printStackTrace();
ControlPanel.getDefault().getLogger().log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

Add helpful message?

} catch (IOException e) {
e.printStackTrace();
ControlPanel.getDefault().getLogger().log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

Add helpful message?

}
}
} catch (FlightRecorderException e) {
e.printStackTrace();
ControlPanel.getDefault().getLogger().log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

Add helpful message?

@@ -380,7 +380,7 @@ void repositoryLoaded(EventArrays repo, IRange<IQuantity> fullRange) {
try {
getSite().getPage().showView(CONTENT_OUTLINE_VIEW_ID, null, IWorkbenchPage.VIEW_VISIBLE);
} catch (PartInitException e) {
e.printStackTrace();
FlightRecorderUI.getDefault().getLogger().log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

Add helpful message?

@@ -1100,8 +1103,7 @@ private void chooseImageFileDialog() {
imageLabel.getParent().layout();
setPageComplete(isPageComplete());
} catch (Exception e) {
// FIXME: Add proper logging
e.printStackTrace();
LOGGER.log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

Add helpful message?

@@ -159,7 +162,7 @@ private void setGroupByField(IAttribute<?> attribute, Boolean ignore) {
try {
buildHistogram();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

Add helpful message?

@@ -176,7 +179,7 @@ private void combinedGrouping(IAttribute<?> attribute, Boolean ignore) {
try {
buildHistogram();
} catch (Exception e) {
e.printStackTrace();
LOGGER.log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

Add helpful message?

@@ -208,7 +208,7 @@ protected void performApply() {
checkedRuleIDs.forEach(id -> ignoredState.createChild(IGNORED_RULES).putString(RULE_ID, id));
getPreferenceStore().setValue(IGNORED_RULES, ignoredState.toString());
} catch (IOException e) {
e.printStackTrace();
FlightRecorderUI.getDefault().getLogger().log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

Add helpful message?

@@ -116,7 +119,7 @@ public boolean hasNext() {
file.close();
} catch (IOException e) {
// Shouldn't happen.
e.printStackTrace();
LOGGER.log(Level.SEVERE, "", e);
Copy link
Member

Choose a reason for hiding this comment

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

Add helpful message?

@openjdk
Copy link

openjdk bot commented Jul 22, 2021

@jpbempel This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

4792: Stop using System.out/err.println and e.printStackTrace

Reviewed-by: hirt

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 15 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Jul 22, 2021
@jpbempel
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jul 22, 2021

Going to push as commit c6e0606.
Since your change was applied there have been 15 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Jul 22, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jul 22, 2021
@openjdk
Copy link

openjdk bot commented Jul 22, 2021

@jpbempel Pushed as commit c6e0606.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@jpbempel jpbempel deleted the 4792 branch September 10, 2021 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants