Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3101

CLI: hide stacktraces for exceptions w/o messages when logging errors

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • 8.1.0.CR1, 8.1.0.Final
    • 8.0.0.Final
    • CLI
    • None

      CommandContextImpl contains the following logic

      public void handleSafe(String line) {
      exitCode = 0;
      try

      { handle(line); }

      catch(Throwable t) {
      final StringBuilder buf = new StringBuilder();
      buf.append(t.getLocalizedMessage());
      Throwable t1 = t.getCause();
      while(t1 != null) {
      if(t1.getLocalizedMessage() != null)

      { buf.append(": ").append(t1.getLocalizedMessage()); }

      else

      { t1.printStackTrace(); }

      t1 = t1.getCause();
      }
      error(buf.toString());
      }
      }

      When an exception does not contain any message, e.g. in some cases IllegalArgumentException, etc, the full stacktraces are logged that are useful for debugging but not nice from the user interface point of view. It was suggested to hide them.

              olubyans@redhat.com Alexey Loubyansky
              olubyans@redhat.com Alexey Loubyansky
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: