Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-6468

Improve Logging of IDoc Errors

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Minor
    • fuse-7.0
    • fuse-6.x-GA
    • Camel
    • None
    • 7.0 Sprint 6

    Description

      Community Member requested this enhancement:

      The logging in IDocUtil could be improved.

      An Exception “Failed to set value” is logged in two positions in Code:
      LOG.warn("Failed to set value", e);
      It would be great for debugging purposes if the exactly field (and the value) is logged.

      Example implementation witch I used during failure analysis:

      public static void setIdocFieldValue(String fieldName, Segment segment, IDocSegment idocSegment)

      { … }

      catch (Exception e)

      { // LOG.warn("Failed to set value", e); logFailedToSetValue(fieldName, segment, idocSegment, e); }

      }

      private static void logFailedToSetValue(String fieldName, Segment segment, IDocSegment idocSegment, Exception e) {
      StringBuilder sb = new StringBuilder();
      try

      { sb.append(idocSegment.getDocument().getMessageType()); sb.append(":"); sb.append(segment.getIdocType()); sb.append("."); sb.append(segment.getDefinition()); }

      catch (Exception ex) {
      } finally

      { sb.append("."); sb.append(fieldName); }

      //TODO: some information about the value itself would also be nice...
      LOG.warn("BF-MODIFICATION: Failed to set value: " + sb.toString(), e);
      }

      This implementation leads to output:
      BF-MODIFICATION: Failed to set value: WMCATO:WMCAID01.E2LTCAH001.SOLEX

      Attachments

        Activity

          People

            bicollin1@redhat.com William Collins (Inactive)
            bicollin1@redhat.com William Collins (Inactive)
            Jan Bouska Jan Bouska
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: