This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 535488 - (RHQ-2178) remove printStackTrace calls and replace with logging
remove printStackTrace calls and replace with logging
Product: RHQ Project
Classification: Other
Component: Agent (Show other bugs)
All All
high Severity medium (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
: CodeChange
Depends On:
  Show dependency treegraph
Reported: 2009-06-26 20:36 EDT by John Mazzitelli
Modified: 2014-05-05 17:46 EDT (History)
4 users (show)

See Also:
Fixed In Version: 1.4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-05-05 17:46:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:

Attachments (Terms of Use)

  None (edit)
Description John Mazzitelli 2009-06-26 20:36:00 EDT
I went through all the places where throwable.printStackTrace is called that should be replaced with logging. This is especially needed for code that will be running in the agent (plugin code for example) because otherwise we are dumping exceptions on the console and it dirties up the user prompt.

People should go through this list and pick off each one of these. Don't have to do it all at once, but we should get it to where all of these are replaced.  Edit this description by putting an "X" in front of the class that you fixed so we can track what has and has not be fixed.

--- CORE --- - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group - rhq/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine - rhq/modules/enterprise/client/src/main/java/org/rhq/enterprise/client (3 matches) - rhq/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav (2 matches) - rhq/modules/core/domain/src/main/java/org/rhq/core/domain/configuration (2 matches) - rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration - rhq/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/metadata - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/display (2 matches) - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/util (3 matches) - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib - rhq/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/i18n (3 matches) - rhq/modules/enterprise/client/src/main/java/org/rhq/enterprise/client - rhq/modules/enterprise/client/src/main/java/org/rhq/enterprise/client - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource - rhq/modules/core/util/src/main/java/org/rhq/core/clientapi/util (3 matches) - rhq/modules/enterprise/client/src/main/java/org/rhq/enterprise/client (4 matches)

--- PLUGINS --- - rhq/modules/plugins/virt/src/main/java/org/rhq/plugins/virt (2 matches) - rhq/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware - rhq/modules/plugins/jira/src/main/java/org/rhq/plugins/jira (8 matches) - rhq/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql (3 matches) - rhq/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres - rhq/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware - rhq/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware - rhq/modules/plugins/snmptrapd/src/main/java/org/rhq/plugins/snmptrapd

---- - jopr/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util (2 matches) - jopr/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util - jopr/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util - jopr/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util (2 matches) - jopr/modules/plugins/jboss-cache/src/main/java/org/rhq/plugins/jbosscache - jopr/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util
Comment 1 Joseph Marques 2009-06-30 13:00:55 EDT
Random thoughts:

Sometimes the stacktrace can be valuable for debugging purposes, so I wouldn't want to get rid of it completely.  I sometimes use the pattern:

} catch (Throwable t) {
   if (log.isDebugEnabled()) {
      log.debug("Some message", t); // the full trace
   } else {
      log.infoOrWarn("Some message: " + t.getMessage()); // just the message

It's debatable, however, whether or not to use different log levels when in debug mode or not.  On occasion, I've used the same level but just changed the amount of debugging:

} catch (Throwable t) {
   if (log.isDebugEnabled()) {
      log.infoOrWarn("Some message", t); // the full trace
   } else {
      log.infoOrWarn("Some message: " + t.getMessage()); // just the message

Just something to consider.
Comment 2 Red Hat Bugzilla 2009-11-10 15:59:21 EST
This bug was previously known as
Comment 3 Bryan Kearney 2010-01-25 10:18:48 EST
When installing the agents on linux with a bad command line parameter you see a stack trace. I dont mind it being in the log file for debug.. but should not show up in the console for command line stuff.

Note You need to log in before you can comment on or make changes to this bug.