This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. 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
Status: CLOSED WONTFIX
Product: RHQ Project
Classification: Other
Component: Agent (Show other bugs)
1.2
All All
high Severity medium (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
http://jira.rhq-project.org/browse/RH...
: CodeChange
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2014-05-05 17:46:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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 ---

AbstractGroupPluginConfigurationUIBean.java - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group
CacheListener.java - rhq/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine
ClientMain.java - rhq/modules/enterprise/client/src/main/java/org/rhq/enterprise/client (3 matches)
ConfigResource.java - rhq/modules/enterprise/gui/webdav-war/src/main/java/org/rhq/gui/webdav (2 matches)
Configuration.java - rhq/modules/core/domain/src/main/java/org/rhq/core/domain/configuration (2 matches)
ConfigurationCheckExecutor.java - rhq/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration
ConfigurationMetadataManagerBean.java - rhq/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/metadata
DateDecorator.java - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib/display (2 matches)
IncludeUIBean.java - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/util (3 matches)
OptionMessageListTag.java - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/taglib
PropertiesGenerator.java - rhq/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/i18n (3 matches)
RemoteClient.java - rhq/modules/enterprise/client/src/main/java/org/rhq/enterprise/client
RemoteClientProxy.java - rhq/modules/enterprise/client/src/main/java/org/rhq/enterprise/client
ResourceGroupTreeStateAdvisor.java - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group
ResourceTreeContextMenuUIBean.java - rhq/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource
StringUtil.java - rhq/modules/core/util/src/main/java/org/rhq/core/clientapi/util (3 matches)
TabularWriter.java - rhq/modules/enterprise/client/src/main/java/org/rhq/enterprise/client (4 matches)

--- PLUGINS ---

DomainConfigurationEditor.java - rhq/modules/plugins/virt/src/main/java/org/rhq/plugins/virt (2 matches)
HardwareComponent.java - rhq/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware
JiraClient.java - rhq/modules/plugins/jira/src/main/java/org/rhq/plugins/jira (8 matches)
MySqlComponent.java - rhq/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql (3 matches)
PostgresUserComponent.java - rhq/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres
SmartDiskComponent.java - rhq/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware
SmartDiskDiscoveryComponent.java - rhq/modules/plugins/hardware/src/main/java/org/rhq/plugins/hardware
SnmpTrapEventPoller.java - rhq/modules/plugins/snmptrapd/src/main/java/org/rhq/plugins/snmptrapd

----

AbstractMessagingConfigurationEditor.java - jopr/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util (2 matches)
DeploymentUtility.java - jopr/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util
JnpConfig.java - jopr/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util
WarDiscoveryHelper.java - jopr/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util (2 matches)
JBossCacheSubsystemComponent.java - jopr/modules/plugins/jboss-cache/src/main/java/org/rhq/plugins/jbosscache
JnpConfig.java - 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 http://jira.rhq-project.org/browse/RHQ-2178
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.