https://bz.apache.org/bugzilla/show_bug.cgi?id=60012

            Bug ID: 60012
           Summary: Several log refactoring/improvement suggestions
           Product: Tomcat 8
           Version: 8.5.x-trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: chen...@gmail.com

Method Invocation Replaced By Variable:

in file:
apache-tomcat-8.5.4-src/java/org/apache/catalina/authenticator/AuthenticatorBase.java
line 441 - 448
principal = session.getPrincipal();
if (principal != null) {
    if (log.isDebugEnabled()) {
        log.debug("We have cached auth type " + session.getAuthType() +
                " for principal " + session.getPrincipal());
    }
    request.setAuthType(session.getAuthType());
    request.setUserPrincipal(principal);
}

"session.getPrincipal()" could be replaced by variable "principal"

in file: apache-tomcat-8.5.4-src/java/org/apache/catalina/realm/JNDIRealm.java
line 2693- 2696

String absoluteName = result.getName();
if (containerLog.isTraceEnabled())
   containerLog.trace("  search returned absolute name: " +
           result.getName());

"result.getName()" can be replaced with "absoluteName"

*Printing null in logs*
apache-tomcat-8.5.4-src/java/org/apache/catalina/storeconfig/StoreLoader.java

line 252 - 254
if ((is == null) || (error != null)) {
    log.error(error);
}

apache-tomcat-8.5.4-src/java/org/apache/catalina/startup/CatalinaProperties.java
line 110 -115
if ((is == null) || (error != null)) {
    // Do something
    log.warn("Failed to load catalina.properties", error);
    // That's fine - we have reasonable defaults.
    properties = new Properties();
}

in the above two scenario, there is a change "error == null", there should be a
null check inside the logs.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to