Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-4578

RESTEasy don't use correct logging on many places

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.0.DR8
    • 7.0.0.CR2
    • REST
    • None

      • RESTEasy don't use correct logging on many places. Loggers should be used instead of "System.out.println" and similar methods. Wrong logging is used often in RESTEasy project in tests, but it is used also in RESTEasy code.
      • Incorrect logging could cause performance issues in RESTEasy or in WildFly.
      • Some numbers:
        [mkopecky@localhost Resteasy] (master)$ git grep "System.out.println" | grep -v docbook | wc -l
        2713
        [mkopecky@localhost Resteasy] (master)$ git grep "System.out.println" | grep -vi test | grep -v examples | grep -v arquillian | grep -v docbook | wc -l
        60
        [mkopecky@localhost Resteasy] (master)$ git grep "printStackTrace" | grep -v docbook | wc -l
        98
        [mkopecky@localhost Resteasy] (master)$ git grep "printStackTrace" | grep -vi test | grep -v examples | grep -v arquillian | grep -v docbook | wc -l
        35
        [mkopecky@localhost Resteasy] (master)$
        

      These cases are most critical, because it is part of RESTEasy code (not tests), that is included in WildFly:

      jaxrs/providers/jaxb/src/main/java/org/jboss/resteasy/plugins/providers/jaxb/IgnoredMediaTypes.java:      System.out.println(getVendorString("foo+json"));
      jaxrs/providers/jaxb/src/main/java/org/jboss/resteasy/plugins/providers/jaxb/IgnoredMediaTypes.java:      System.out.println(getSubtype("foo+json"));
      jaxrs/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartFormDataReader.java:      System.out.println(new String(baos.toByteArray()));
      jaxrs/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartInputImpl.java:      System.out.println(multipart.getPreamble());
      jaxrs/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartInputImpl.java:      System.out.println("**********");
      jaxrs/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartInputImpl.java:         System.out.println("--");
      jaxrs/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartInputImpl.java:         System.out.println("\"" + part.getBodyAsString() + "\"");
      jaxrs/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartInputImpl.java:      System.out.println("done");
      jaxrs/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartReader.java:      System.out.println(writer.toString());
      jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/util/Base64.java:               e.printStackTrace();
      jaxrs/resteasy-wadl/src/main/java/org/jboss/resteasy/wadl/ResteasyWadlDefaultResource.java:            e.printStackTrace();
      

      But correct logging should be in whole RESTEasy project.

      RESTEasy has even some kind of check of usage of "System.out.println", "System.err.println" and "printStackTrace":
      https://github.com/resteasy/Resteasy/blob/master/jaxrs/config/jboss_checks.xml#L121

              fedor.gavrilov Fedor Gavrilov (Inactive)
              mkopecky@redhat.com Marek Kopecky
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: