Bug 1400226 - Fix CommandsFactory logging to show original cause of the issue
Summary: Fix CommandsFactory logging to show original cause of the issue
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Infra
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ovirt-4.2.0
: 4.2.0
Assignee: Miroslava Voglova
QA Contact: Pavel Stehlik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-30 17:24 UTC by Martin Mucha
Modified: 2017-12-20 11:01 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-12-20 11:01:14 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 78996 0 master MERGED core: log root cause exception in CommandsFactory 2017-07-04 19:09:30 UTC

Description Martin Mucha 2016-11-30 17:24:28 UTC
Description of problem:

In code, we often swallow exceptions. There isn't any benefit (know to me), to do so.


Example from CommandsFactory:

catch (Exception ex) {
            log.error("An exception has occurred while trying to create a command object for command '{}' with parameters '{}': {}",
                    action.name(),
                    parameters,
                    ex.getMessage());
            log.debug("Exception", ex);
            return null;
        }

which will print this into log:

ERROR [org.ovirt.engine.core.bll.CommandsFactory] (default task-45) [0cf7f066-8328-4d77-a35f-dac2d37f058b] An exception has occurred while trying to create a command object for command 'RunVm' with parameters 'RunVmParams:{commandId='0625b1bb-8924-48eb-aa08-84e10f97fbb8', user='null', commandType='Unknown', vmId='43f269c7-5341-41de-894b-7205fbc23a3b'}': WELD-000049: Unable to invoke protected final void org.ovirt.engine.core.bll.CommandBase.postConstruct() on org.ovirt.engine.core.bll.RunVmCommand@55495ef8


Exception: java.lang.NullPointerException
	at org.ovirt.engine.core.bll.NestedCommandFactory.createWrappedCommand(NestedCommandFactory.java:24) [bll.jar:]
	at org.ovirt.engine.core.bll.PrevalidatingMultipleActionsRunner.initCommandsAndReturnValues(PrevalidatingMultipleActionsRunner.java:91) [bll.jar:]
…

which is both totally irrelevant and without problem. One has to enter debugging session to find out:

Caused by: org.postgresql.util.PSQLException: The column name pass_discard was not found in this ResultSet.

————————————————
Intent of this code is totally misleaded. It does not make logs any shorter, and instead of logging causing exception as ERROR, we log as error something which is totally fine. Every such:

log.error
log.debug
swallow

should disappear from code as it severely damages our logs.

Comment 1 Pavel Stehlik 2017-08-30 12:07:38 UTC
CodeChange - nothing for QE.

Comment 2 Sandro Bonazzola 2017-12-20 11:01:14 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


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