[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zhenhao Li updated CLOUDSTACK-10315:
------------------------------------
    Description: 
We found that some logging statements have same log message, but one of them 
has stack trace info, the other one of them doesn't have. Maybe a possible 
reason is that they are code clone, developers changed one of them(add stack 
trace info) but forgot to change the other one. Here's the details of those 
logging statements we found:

 

 1.*"Moving on to the next host because " + h.toString() + " is unavailable"*,

_com.cloud.hypervisor.ovm3.resources.Ovm3FenceBuilder.*fenceOff()*,_

_com.cloud.ha.SimulatorFencer.*fenceOff()*_, 

There are two identical log messages in these two places, the previous one 
logged stack trace:

!image-2018-03-26-17-45-44-489.png!

But the latter one did not:

!image-2018-03-05-09-59-19-369.png!

We can see that they are in different type of catch block, but when checking 
the logs they generated, maybe it's impossible to know the difference of them 
without stack trace. So maybe the stack traces info should also be added here?

 

2.*"Network rule Conflict"*

_org.apache.cloudstack.api.command.user.firewall.CreatePortForwardingRuleCmd.*create()*,_

_org.apache.cloudstack.api.command.user.firewall.CreateFirewallRuleCmd.*create()*_

 

The previous one has these two logging statements:

s_logger.info("Network rule conflict: ", ex);

s_logger.trace("Network Rule Conflict: ", ex);

 

Comparing to the latter one which contains:

s_logger.info("Network rule conflict: " + ex.getMessage());

s_logger.trace("Network Rule Conflict: ", ex);

Maybe it's better to have consistent exception handling here?

 

 

 

  was:
We found that some logging statements have same log message, but one of them 
has stack trace info, the other one of them doesn't have. Maybe a possible 
reason is that they are code clone, developers changed one of them(add stack 
trace info) but forgot to change the other one. Here's the details of those 
logging statements we found:

 

 1.*"Moving on to the next host because " + h.toString() + " is unavailable"*,

_com.cloud.hypervisor.ovm3.resources.Ovm3FenceBuilder.*fenceOff()*,_

_com.cloud.ha.SimulatorFencer.*fenceOff()*_, 

There are two identical log messages in these two places, the previous one 
logged stack trace:

!image-2018-03-26-17-45-44-489.png!

But the latter one did not:

!image-2018-03-05-09-59-19-369.png!

We can see that they are in different type of catch block, but when checking 
the logs they generated, maybe it's impossible to know the difference of them 
without stack trace. So maybe the stack traces info should also be added here?

 

2.*"Network rule Conflict"*

_org.apache.cloudstack.api.command.user.firewall.CreatePortForwardingRuleCmd.*create()*,_

_org.apache.cloudstack.api.command.user.firewall.CreateFirewallRuleCmd.*create()*_

 

The previous one has these two logging statements:

s_logger.info("Network rule conflict: ", ex);

s_logger.trace("Network Rule Conflict: ", ex);

 

Comparing to the latter one which contains:

s_logger.info("Network rule conflict: " + ex.getMessage());

s_logger.trace("Network Rule Conflict: ", ex);

Maybe it's better to have consistent exception handling here?

 

3.*"Failed to take snapshot: "*

_org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl.*takeSnapshot()*,_

_org.apache.cloudstack.storage.datastore.driver.ElastistorPrimaryDataStoreDriver.*takeSnapshot()*_

The previous one has catch block:

!image-2018-03-05-10-14-00-552.png!

and the latter one:

!image-2018-03-05-10-14-25-802.png!

We can see that the code snippers are almost the same except the logging 
statements.

Will it be better to change the latter one, to be consistent with the previous 
one?

 


> Inconsistent debugging info in catch block
> ------------------------------------------
>
>                 Key: CLOUDSTACK-10315
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10315
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>            Reporter: Zhenhao Li
>            Priority: Minor
>              Labels: easyfix
>         Attachments: image-2018-03-05-09-59-19-369.png, 
> image-2018-03-05-10-14-00-552.png, image-2018-03-05-10-14-25-802.png, 
> image-2018-03-26-17-45-44-489.png
>
>
> We found that some logging statements have same log message, but one of them 
> has stack trace info, the other one of them doesn't have. Maybe a possible 
> reason is that they are code clone, developers changed one of them(add stack 
> trace info) but forgot to change the other one. Here's the details of those 
> logging statements we found:
>  
>  1.*"Moving on to the next host because " + h.toString() + " is unavailable"*,
> _com.cloud.hypervisor.ovm3.resources.Ovm3FenceBuilder.*fenceOff()*,_
> _com.cloud.ha.SimulatorFencer.*fenceOff()*_, 
> There are two identical log messages in these two places, the previous one 
> logged stack trace:
> !image-2018-03-26-17-45-44-489.png!
> But the latter one did not:
> !image-2018-03-05-09-59-19-369.png!
> We can see that they are in different type of catch block, but when checking 
> the logs they generated, maybe it's impossible to know the difference of them 
> without stack trace. So maybe the stack traces info should also be added here?
>  
> 2.*"Network rule Conflict"*
> _org.apache.cloudstack.api.command.user.firewall.CreatePortForwardingRuleCmd.*create()*,_
> _org.apache.cloudstack.api.command.user.firewall.CreateFirewallRuleCmd.*create()*_
>  
> The previous one has these two logging statements:
> s_logger.info("Network rule conflict: ", ex);
> s_logger.trace("Network Rule Conflict: ", ex);
>  
> Comparing to the latter one which contains:
> s_logger.info("Network rule conflict: " + ex.getMessage());
> s_logger.trace("Network Rule Conflict: ", ex);
> Maybe it's better to have consistent exception handling here?
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to