Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-1346

ProjectStageProducer should log changed values only if the value changed

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.8.2
    • 1.9.0
    • Core
    • None

    Description

      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:

      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);
      }

      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:

      if (!Objects.equals(projectStage, ps)) {
          LOG.info("change project-stage from " + projectStage + " to " + ps);
      }

      Attachments

        Activity

          People

            gpetracek Gerhard Petracek
            jensberke Jens Berke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: