You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by bl...@apache.org on 2009/12/14 17:40:54 UTC

svn commit: r890399 - /incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java

Author: bluk
Date: Mon Dec 14 16:40:53 2009
New Revision: 890399

URL: http://svn.apache.org/viewvc?rev=890399&view=rev
Log:
Reduce logging in error path case

Stacktraces/exception objects still avaialble
in debug mode but in normal mode a simpler
info message is logged.  Exception still thrown
to container and in Geronim/Tomcat this
means the stack trace is still printed out to
the container log outside of Wink.

See [WINK-240]

Modified:
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java?rev=890399&r1=890398&r2=890399&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java (original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java Mon Dec 14 16:40:53 2009
@@ -133,7 +133,11 @@
             handleRequestWithoutFaultBarrier(request, response);
         } catch (Throwable t) {
             // exception was not handled properly
-            logger.error(Messages.getMessage("unhandledExceptionToContainer"), t);
+            if (logger.isDebugEnabled()) {
+                logger.debug(Messages.getMessage("unhandledExceptionToContainer"), t);
+            } else {
+                logger.info(Messages.getMessage("unhandledExceptionToContainer"));
+            }
             if (t instanceof RuntimeException) {
                 // let the servlet container to handle the runtime exception
                 throw (RuntimeException)t;
@@ -186,7 +190,11 @@
             exceptionName =
                 String.format("%s (%d%s%s)", exceptionName, statusCode, statusSep, statusMessage);
             if (statusCode >= 500) {
-                logger.error(String.format(messageFormat, exceptionName), t);
+                if (logger.isDebugEnabled()) {
+                    logger.debug(String.format(messageFormat, exceptionName), t);
+                } else {
+                    logger.info(String.format(messageFormat, exceptionName));
+                }
             } else {
                 // don't log the whole call stack for sub-500 return codes unless debugging
                 if (logger.isDebugEnabled()) {
@@ -196,7 +204,11 @@
                 }
             }
         } else {
-            logger.error(String.format(messageFormat, exceptionName), t);
+            if (logger.isDebugEnabled()) {
+                logger.debug(String.format(messageFormat, exceptionName), t);
+            } else {
+                logger.info(String.format(messageFormat, exceptionName));
+            }
         }
     }