I generally disagree with this:  I believe exception stack traces
should always be logged.

If this individual exception is occurring too often, you could:
 - install a log handler that snips exception traces
 - lower the log level overall
 - log twice, the second time at FINE with the exception
     log.log(Level.WARNING, "IO Error rewriting image " +
request.toString() + "-" + ioe.getMessage());
     log.log(Level.FINE, ioe);
 - best of all, use log levels to decide whether to include the stack trace:
  if (log.isLoggable(Level.FINE)) {
    log.log(Level.WARNING, "IO Error rewriting image " +
request.toString(), ioe);
  } else {
    log.log(Level.WARNING, "IO Error rewriting image " +
request.toString() + "-" + ioe.getMessage());
  }

... so anyone that needs to diagnose the exception has some recourse.

On Sun, Aug 2, 2009 at 11:40 PM, <[email protected]> wrote:
> Author: lindner
> Date: Mon Aug  3 06:40:55 2009
> New Revision: 800211
>
> URL: http://svn.apache.org/viewvc?rev=800211&view=rev
> Log:
> tamp down some exception logging. remove some hay from the haystack
>
> Modified:
>    
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
>
> Modified: 
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
> URL: 
> http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java?rev=800211&r1=800210&r2=800211&view=diff
> ==============================================================================
> --- 
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
>  (original)
> +++ 
> incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
>  Mon Aug  3 06:40:55 2009
> @@ -201,13 +201,13 @@
>       response = getOptimizer(response, imageFormat, image);
>       totalRewrittenImageBytes.addAndGet(response.getContentLength());
>     } catch (IOException ioe) {
> -      log.log(Level.WARNING, "IO Error rewriting image " + 
> request.toString(), ioe);
> +      log.log(Level.WARNING, "IO Error rewriting image " + 
> request.toString() + " - " + ioe.getMessage());
>     } catch (RuntimeException re) {
>       // This is safe to recover from and necessary because the 
> ImageIO/Sanselan calls can
>       // throw a very wide variety of exceptions
>       log.log(Level.INFO, "Unknown error rewriting image " + 
> request.toString(), re);
>     } catch (ImageReadException ire) {
> -      log.log(Level.INFO, "Failed to read image. Skipping " + 
> request.toString(), ire);
> +      log.log(Level.INFO, "Failed to read image. Skipping " + 
> request.toString(), ire.getMessage());
>     }
>     return response;
>   }
>
>
>

Reply via email to