[jira] [Commented] (DELTASPIKE-1346) ProjectStageProducer should log changed values only if the value changed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (DELTASPIKE-1346) ProjectStageProducer should log changed values only if the value changed

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/DELTASPIKE-1346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16491775#comment-16491775 ]

ASF subversion and git services commented on DELTASPIKE-1346:
-------------------------------------------------------------

Commit 06c3b14457281b7103190321f981e45ec5ddd244 in deltaspike's branch refs/heads/master from [~gpetracek]
[ https://git-wip-us.apache.org/repos/asf?p=deltaspike.git;h=06c3b14 ]

DELTASPIKE-1346 only log new project-stage values


> ProjectStageProducer should log changed values only if the value changed
> ------------------------------------------------------------------------
>
>                 Key: DELTASPIKE-1346
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1346
>             Project: DeltaSpike
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.8.2
>            Reporter: Jens Berke
>            Assignee: Gerhard Petracek
>            Priority: Minor
>             Fix For: 1.9.0
>
>
> The change in DELTASPIKE-1329 logs a message every time the project stage is set, even is the new value is the same as the previous one, and it can flood your log with numerous messages "change project-stage from UnitTest to UnitTest" when running unit tests.
> I think it's better if the message is only logged if the new value is actually different from the previous one - which also seems to have been the intention of DELTASPIKE-1329 according to its summary.
> Example for an implementation:
> {code:java}
> String psNameOld = projectStage == null ? "" : projectStage.toString();
> String psNameNew = ps == null ? "" : ps.toString();
> if (!psNameNew.equals(psNameOld)) {
>     LOG.info("change project-stage from " + projectStage + " to " + ps);
> }{code}
> For DeltaSpike versions which require at least Java 1.7. and later, and if ProjectStage had a proper equals method, this could be simplified to:
> {code:java}
> if (!Objects.equals(projectStage, ps)) {
>     LOG.info("change project-stage from " + projectStage + " to " + ps);
> }{code}



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