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

            Bug ID: 63287
           Summary: Inconsistent log level practices in Catalina component
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: anu...@163.com
  Target Milestone: -----

Inconsistent log level practices in similar code snippets as well as the
modification suggestion are shown below.

***************** Report1 *********************************
the problematic snippet:
============ JAASMemoryLoginModule.java ===================
file path: tomcat\java\org\apache\catalina\realm\JAASMemoryLoginModule.java
logging statement line: 403
modification suggestion: change log level to ERROR
399         try {
400             digester.push(this);
401             digester.parse(file);
402         } catch (Exception e) {
403             log.warn(sm.getString("jaasMemoryLoginModule.parseError", 
                file.getAbsolutePath()), e);
404         } finally {
405             digester.reset();
406         }

the similar snippet:
============ MbeansDescriptorsDigesterSource.java =========
filepath:tomcat\java\org\apache\tomcat\util\modeler\modules\MbeansDescriptorsDigesterSource.java
logging statement line:171
166             try {
167                 // Push our registry object onto the stack
168                 digester.push(loadedMbeans);
169                 digester.parse(stream);
170             } catch (Exception e) {
171                 log.error(sm.getString("modules.digesterParseError"), e);
172                 throw e;
173             } finally {
174                 digester.reset();
175             }

***************** Report2 *********************************
the problematic snippet:
============ AccessLogValve.java ===================
file path: tomcat\java\org\apache\catalina\valves\AccessLogValve.java
logging statement line: 642
modification suggestion: change log level to WARN
639             try {
640                 charset = B2CConverter.getCharset(encoding);
641             } catch (UnsupportedEncodingException ex) {
642                 log.error(sm.getString(
643                         "accessLogValve.unsupportedEncoding", encoding),
ex);
644             }

the similar snippets:
============ Response.java =========================
file path: tomcat\java\org\apache\coyote\Response.java
logging statement line: 550
547                 try {
548                     charset = B2CConverter.getCharset(charsetValue);
549                 } catch (UnsupportedEncodingException e) {
550                     log.warn(sm.getString("response.encoding.invalid",
charsetValue), e);
551                 }

============ MessageDigestCredentialHandler.java ===
file path:
tomcat\java\org\apache\catalina\realm\MessageDigestCredentialHandler.java
logging statement line: 75
72             try {
73                 this.encoding = B2CConverter.getCharset(encodingName);
74             } catch (UnsupportedEncodingException e) {
75                 log.warn(sm.getString("mdCredentialHandler.unknownEncoding",
76                         encodingName, encoding.name()));
77             }

============ Connector.java ========================
file path: tomcat\java\org\apache\catalina\connector\Connector.java
logging statement line: 752
749         try {
750             uriCharset = B2CConverter.getCharset(URIEncoding);
751         } catch (UnsupportedEncodingException e) {
752             log.warn(sm.getString("coyoteConnector.invalidEncoding",
753                     URIEncoding, uriCharset.name()), e);
754         }

***************** Report3 *********************************
the problematic snippet:
============ StaticMembershipProvider.java =========
file path:
tomcat\java\org\apache\catalina\tribes\membership\StaticMembershipProvider.java
logging statement line: 402
modification suggestion: change log level to ERROR
397                 try {
398                     sleep(pingInterval);
399                     ping();
400                 }catch (InterruptedException ix) {
401                 }catch (Exception x) {
402                    
log.warn(sm.getString("staticMembershipProvider.pingThread.failed"),x);
403                 }


the similar snippet:
============ StaticMembershipProvider.java =========
file path:
tomcat\java\org\apache\catalina\tribes\membership\StaticMembershipProvider.java
logging statement line:274
271         try {
272             if (!useThread) ping();
273         } catch (ChannelException e) {
274            
log.error(sm.getString("staticMembershipProvider.heartbeat.failed"), e);
275         }

-- 
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